Ambiguous Grammar

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2022 Oct 7 3:33
Editor
Edited
Edited
2022 Oct 7 3:47
Refs
Refs
  • Add disambiguous rules
  • Rewrite the grammar
    • Recursion Removal
      • Replace one of the recurisons with the base case
    • Precedence Cascade
      • group operators of same precedence; write a different rule for each precedence group
 
 
 
ambiguous grammar may always produce unique AST (but may produce different parse trees)
Inessential Ambiguity (okay)
  • even for ambiguous grammar producing different ASTs
  • Both carry the same semantics
 
 
 
 

Recommendations