01: CODE → VDECL CODE | FDECL CODE | ε
02: VDECL → vtype id semi | vtype ASSIGN semi
03: ASSIGN → id assign RHS
04: RHS → EXPR | literal | character | boolstr
05: EXPR → TERM EXPR’
06: EXPR’ → addsub TERM EXPR’ | ε
07: TERM → FACTOR TERM’
08: TERM’ → multdiv FACTOR TERM’ | ε
09: FACTOR → lparen EXPR rparen | id | num
10: FDECL → vtype id lparen ARG rparen lbrace BLOCK RETURN rbrace
11: ARG → vtype id MOREARGS | ε
12: MOREARGS → comma vtype id MOREARGS | ε
13: BLOCK → STMT BLOCK | ε
14: STMT → VDECL | ASSIGN semi | if lparen COND rparen lbrace BLOCK rbrace ELSE | while lparen COND rparen lbrace BLOCK rbrace
15: COND → boolstr COND’
16: COND’ → comp boolstr COND’ | ε
17: ELSE → else lbrace BLOCK rbrace | ε
18: RETURN → return RHS semi
It is not possible to create a parseing table using the following site with the grammar that removes ambiguity.
https://jsmachines.sourceforge.net/machines/slr.html
It doesn’t change even if I add grammar and press the button.
ᄎ지혜 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.