toylisp: Development Log
06.04.2022 - Compiling IF statement
If statements and function are the tricky thing to me, now I have to add label support, a label is also a statement that has the form of:
Ideally, the instruction list will be able to keep track of the label position, so it can jump to a label at any time….
05.20.2022 - Adding symbol table
Not much for today, just adding some unit tests and implement a symbol table during the compilation process. The way it works is pretty much like the Constant Table that was mentioned yesterday.
If we have a let statement like in the following example, after the compilation process, the STORE_NAME
opcode will be generated with the address of the a
symbol….
05.19.2022 - Work in progress compiling logic
Started working on compiling logic, at this point, the compiler is capable of generating the opcode for the print
, let
statement and some arithmetic operators.
…
05.18.2022 - Generating parser code with PeggyJS
For this project, I’ll just use a generator to create parser code, as I want to focus on the bytecode virtual machine.
PeggyJS is the best generator I could find for now, it even supports TypeScript, this mean, we can control the return type for each non-terminals….