como-lang-ng icon indicating copy to clipboard operation
como-lang-ng copied to clipboard

Compiler, Parser, Executor separation

Open rmccullagh opened this issue 9 years ago • 2 comments

Write now como_compiler.c is really sloppy and includes the ast construction stage, compiling stage, and execution stage. What needs to happen is that the como_compiler.c needs to only do compiling onto a new struct which is just an array of ComoByteCode blocks.

After that, the executor can be cleaner by implementing it as a series of function pointers.

rmccullagh avatar Sep 13 '16 00:09 rmccullagh

The design of the executor, the executor will have an array of ComoOpCode structs embedded in the main ExecutionEnvironment structure. The ExecutionEnvrionment structure will contain the program counter, and the stack.

The ExecutionEnvironment structure will also contain the symbol tables for each frame. A frame is a ComoByteCode struct.

The ExecutionEnvrionment structure implements the Virtual Machine for this language.

rmccullagh avatar Sep 14 '16 22:09 rmccullagh

Update: I am working on implementing this.

rmccullagh avatar Sep 20 '16 20:09 rmccullagh