Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个 pegjs 语法。如何删除左递归?
atom = term / "^" / "_" / "\\" / atom "." / atom "." label / atom ".(" labels ")" term = [a-zA-Z0-9]+ labels = label ("|" label)* label = ("+" / "-")* [A-Za-z0-9]+
应该是这样的……
atomStatement = atom "." / atom "." label / atom ".(" labels ")" / atom atom = term / "^" / "_" / "\\" term = [a-zA-Z0-9]+ labels = label ("|" label)* label = ("+" / "-")* [A-Za-z0-9]+