This is the project I need a tree data structure for. The parser would return a populated tree data structure instead of emitting SmileBASIC. The parser would pass this tree to the type checker and the type checker would type check everything recursively with a DFS algorithm if it encounters a type error it will alert the user and stop. If no errors are encountered the type checker will pass the type checked tree on to the code generator etc. etc.
1+1;into stack based SmileBASIC code like these:
DIM S[32] PUSH S,1 PUSH S,1 R=POP(S) L=POP(S) PUSH S,L+R PRINT POP(S)I plan to expand this into a much larger fully featured compiler for a programming language.
Instructions:
Change your active project to MATHC go to create programs with SmileBASIC in the main menu. Run this command in direct mode:EXEC "PRG1:COMPILER"The compiler will compile the code in IN and output SmileBASIC to OUT. If you wish to change the input to compiler you can edit the file named IN.