YannCaron / JinyParser

A java parser based on combinatoric framework
2 stars 0 forks source link

Manage Direct Left recursion #7

Closed YannCaron closed 8 years ago

YannCaron commented 9 years ago

See http://tratt.net/laurie/research/pubs/html/tratt__direct_left_recursive_parsing_expression_grammars/ and https://fr.wikipedia.org/wiki/Analyseur_LR and http://web.cs.wpi.edu/~kal/PLT/PLT4.1.2.html (important) and http://www.d.umn.edu/~hudson/5641/l11m.pdf / http://www.d.umn.edu/~hudson/5641/

R → R a | b 

becomes

R → b R′
R′→ a R′ | ε 

Thus

E → E + E | E * E | Num | ( E )

becomes

E -> Num E' | ( E ) E'
E' -> + E E' | * E E' | ε
YannCaron commented 8 years ago

Done