iwandejong / 341-project

0 stars 0 forks source link

Fix CFG rulesets #9

Open iwandejong opened 4 weeks ago

iwandejong commented 4 weeks ago

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.

iwandejong commented 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.

iwandejong commented 3 weeks ago

LL1 doesn't seem to be viable. Need to figure out something different...