« At the peak | Main | Goals for release 0.37 »

March 15, 2005

Release 0.36 ( Cardinal )

ConteX 0.36 'Cardinal' is finally released! Click the 'Download' link to get it.

I named this release "Cardinal" , after the state bird of Virginia. For now on, I'll be naming my releases after pretty birds.

On the more serious subject, this project has undergone a true rebirth. The only thing that hasn't changed is my StateMachine, the system used to tell the parser 'what' it is parsing as it parses character by character. From beginning to end, the evaluation system has a clean, comprehensible algorithm.

To understand the evaluation system of CX, one must have a knowledge of how cons cells work.

The parser now produces a cons list, made of linked objects of the class ConsCell. The Evaluator takes the head ConsCell (technically, the whole list) and pushes it onto the callstack. Next, the evaluator goes into a loop, where it evaluates the top of the callstack until the stack is empty. The cool thing is that the first cons cell will push the next cell on the callstack, and then it pushes its car, so the next thing evaluated is the wrapped object (the car) in this cons cell, and then the next cell! If the cell happened to be wrapping another cons cell, the wrapped cons list will do the 'roll out' onto the callstack, then the 'parent list' will continue again. If a cons cell has no cdr, it doesn't push anything but its car onto the callstack. This doesnt mean that the evaluator is done; there could still be something on the callstack because this cell was the CAR of the last cell, and there is another cell pushed before this one.

Wrap your mind around that, and you understand the evaluation loop of CX. This algorithm leads to automatic tail call elimination, though I'm fixing the same elimination for functions that end with a branch.

With this new codebase, the coding will mostly be done in CX, so almost all of the work will be in the 'kit' directory of the project. Cardinal now has a stable, reliable codebase, with the potential to accomplish the goals I originally planned.

Posted by Rex at March 15, 2005 02:12 AM

Comments

Post a comment




Remember Me?