I am presently working on a project to build a small c compiler to run on a pmachine. Presently, i started off using a stripped version of a full c grammar. Parsing looks okay at the moment and i used the rewrite rules to build the AST which looks kinda okay. Presently, i am in the phase of building a tree grammar to walk and generate pmachinecode. My question is,
Will the tree grammar be a feasible choice to walk the tree and generate p-code ? (e.g i run an expression and return a string of pcode) or is the approach of building the AST manually without Antlr the right way to achieve this ?
I just want to know if i am really on track using the tree grammar or not.
Your advice will be much appreciated.
Best regards.