? Math Compiler ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password

Math Compiler

Submitted
Updated
Author
ninjagnu
Public Key
8RNQ23CJ
Min. Compat.
All
Rating
0 votes
Description Compiles simple semicolon separated math expressions like this one, 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.
Categories
Keywords
4 Comment(s) Lumage Lumage Head Admin interesting ninjagnu ninjagnu Avatar Taboo I didn't change my avatar for 180 days Website Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength 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. Lumage Lumage Head Admin Right. If you do get that malloc/tree implementation, it would be neat if you could publish it as a separate library so other people can find it easily, too. ninjagnu ninjagnu Avatar Taboo I didn't change my avatar for 180 days Website Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Will do, I think I've got an idea on how things should work. Just need to get a working flow chart done on paper so I can visualize things.