monic part 5: writing C programs on the calculator
|
02-17-2021, 10:48 PM
Post: #16
|
|||
|
|||
RE: monic part 5: writing C programs on the calculator
(02-17-2021 09:14 AM)F-73P Wrote: Thanks Jonathan for your helpful advice, always appreciated. You're welcome Quote:I removed "int" from the type_specifier grammar production and replaced it with "apq" (arbitrary precision rational), "apf" (arbitrary precision float - not supported on the calculator yet) and "int32_t" (maybe?). Nice Keep up the good work Quote:There were a few aspects of the original BNF grammar I found confusing: This is to allow empty expressions. You need this in cases such as : Code: while(x != somevalue) ; Which could be used for busy waiting ( eg. a "spinlock" ) Quote:2) expression -> var = expression | simple expression Yep In the EBNF grammar it is : Code: expression = { var , "=" } , simple-expression ; Quote:I added some code generation instructions to the parser and now simple C programs like the factorial program below can be executed: Nice work! I look forward to seeing how your project evolves Regards, Jonathan Aeternitas modo est. Longa non est, paene nil. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 7 Guest(s)