On Friday, 26 October 2018 at 07:36:50 UTC, drug wrote:
25.10.2018 23:34, Michelle Long пишет:
Ignores spaces: <-
Doesn't: <
Concatenates results: <~
Thank you for sharing your results!
I got it backwards when posting:
/*
< (space arrow) consume spaces before, between and after
elements
<-
<~ (squiggly arrow) concatenates the captures on the right-hand
side of the arrow.
<: (colon arrow) drops the entire rule result (useful to ignore
comments, for example)
<^ (keep arrow) that calls the 'keep' operator to all
subelements in a rule.
/ binary operator - conditional or (Matches first rule, if
fails then matches the next)
| binary operator - Longest match alternation(matches the
longest rule first)
: Prefix that ignores match in rule but requires it to be valid.
*/
List is not complete, maybe I will update.
What would be really cool if one could have an autogrammar
generator! Somehow it looks at text and figures out the grammar.
Might require some human interaction but can figure out the rules
that will generate the specific grammars. Maybe neural net could
do it? Train it enough and it could be fairly accurate and a
human just has to fix up small cases.
e.g., get a few million lines of C++ source code, pass in to the
generator and it pops out a grammar for it! Should be possible
since it's usually 1 to 1(for peg grammars at least).