On Wed, Nov 22, 2017 at 10:29 AM, Gleki Arxokuna <gleki.is.my.name@gmail.com> wrote:PEG has no tools to check for ambiguity, it simply does not support it, it's another grammar with its own drawbacks. It can't be compared to YACC, it's just another class of grammars.If you want tools resolving ambiguity then having tools not more powerful than PEG or CFG is not enough.Since the absence of syntactic ambiguity is one of (my) requirement for Lojban, let me understand better.In CFG the source of ambiguity is the at any given moment in parsing one can choos which alternative path to follow.So, for example, the following CFG grammar is ambiguous:E = E '+' E | E '-' E | NN = '0' | '1' | ... | '9'because the string "4+3-9" may result in two different parse tree:E E
/ | \ / | \
E + E E - E
| / | \ / | \ |
4 E - E E + E 9
| | | |
3 9 4 3The corresponding PEG would be:E = E '+' E / E '-' E | NN = '0' / '1' / ... / '9'And there is only parse tree for "4+3+9"E
/ | \
E + E
| / | \
4 E - E
| |
3 9(note that PEG do support left recursion even if the original packrat algorithm didn't)CFG grammars need to be checked for ambiguities
and have to be rewritten to eliminate them whereas PEG do not have this problem (and hence lack a tool for checking ambiguities).
I do agree that ensuring that a PEG grammar does exactly what you want it to do is not easy (especially if it's a complex grammar) but "per se" the PEG itself does not introduce any ambiguity.Is this what you meant or am I missing something?--
You received this message because you are subscribed to a topic in the Google Groups "lojban" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lojban/e94H-wdh5gc/ .unsubscribe
To unsubscribe from this group and all its topics, send an email to lojban+unsubscribe@googlegroups.com .
To post to this group, send email to lojban@googlegroups.com.
Visit this group at https://groups.google.com/group/lojban .
For more options, visit https://groups.google.com/d/optout .