Open iwandejong opened 4 weeks ago
This is partially fixed. Next problem is the amount of branching that comes with the recursive function. Will look into FIRST/FOLLOW sets to build a LL1-parser essentially.
LL1 doesn't seem to be viable. Need to figure out something different...
Currently the problem is popping from the stack with the parser.
Let's say you have:
When parsing, you need to enter PROG, go to main, go to GLOBVARS, but find that it's a non-terminal node, therefore enter it (i.e. push to the stack), traverse the whole GLOBVARS rule, then pop from the stack (indicating the GLOBVARS rule has been successfully completed).
When GLOBVARS does not get popped from the stack, it means that the parsing is unsuccessful. Example: "main noValue ..." fails in parsing, but "main someValue ..." doesn't.