The part everybody has been waiting for: code generation! Try using -o
or --oast
to view the optimized AST.
This represents a nice case of one program failing semantic analysis and one passing with the passing one moving on to codegen.
Now that we have the semantic error removed we can see that everything works properly. Unless you run out of memory that is :/ Those darn expressions just take up too many opcodes.
Finally, a proper test of the expressions code generation.
A simple test of nested if statements
A bit more complex with an if statement combined with a while statement.
This tests my compiler's ability to compare strings.