[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bpfk] Does Lojban PEG need a "naughty OR" operator?



There is a language.js PEG library that adds a new " % " operator ("naughty OR") used only if the parse completely fails.
This " % " can be used to show all errors in the tree. Finding the first error doesn't stop the tree from being generated.

language.js seems to be an abandonware whereas PEG.js which camxes.js is based upon is an actively developed library.

The authors of PEG.js once were asked if " % "could be implemented in PEG.js. The reply was that it's not clearly understandable how it can be better than the already existing " / { ... }" in PEG.js. [ https://github.com/pegjs/pegjs/issues/145 ]

I doubt too whether we really need naughty OR. " / { ... }" is what xorxes and I have been doing for the last weeks and the goal was exactly to continue parsing the tree if something is omitted. This allowed e.g. parsing 
"mi djica lo nu lo plise" which in the official grammar was invalid.

" / " is a prioritized choice operator
" { ... } " are parser actions that send desired _javascript_ actions to the output and thus generate the syntax tree among other things.

E.g. I proposed adding " / COhE_elidible" where COhE_elidible returns a " { ... } " _expression_.

So instead of one error message we get numerous "autorestored" nodes instead of just one error message "your parse failed".

So unless anyone explains why naughty OR is better than what has been done I will continue to think that PEG.js is fine and more such " / {...} " improvements are needed.

--
You received this message because you are subscribed to the Google Groups "BPFK" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bpfk-list+unsubscribe@googlegroups.com.
To post to this group, send email to bpfk-list@googlegroups.com.
Visit this group at http://groups.google.com/group/bpfk-list.
For more options, visit https://groups.google.com/d/optout.