|
|
|
|
|
by sshine
2381 days ago
|
|
Skipping to "Glush, the algorithm" can be helpful if you already know the history of parsing. TL;DR: Glush grammars consist of "rules" that are regexes + recursion of rule calls. Compiles to NFAs. I'm not sure I see the point in declaring precedence levels inside rules -- maybe it's just a preference thing, but I like having operator precedences in a separate section of the grammar. Yacc does this. Megaparsec for Haskell does this. This reminds me of two things: 1. How syntax highlighting is implemented in Vim and GEdit (which is to say GtkSourceView). See for example how "contexts" can be nested here: https://github.com/rubencaro/gedit_hacks/blob/master/.local/... 2. Kleenex: https://kleenexlang.org - https://github.com/diku-kmc/kleenexlang - a silly example: https://github.com/athas/EggsML/blob/master/concieggs/compil... I am tempted to classify this as "regex extended with recursion" rather than "an alternative to CFGs", since I cannot decipher from the article the exact expressive power. |
|
No. It cannot, since NFAs cannot parse languages that are not regular. Rather, the algorithm executes like a pushdown automaton. I don't think it's correct to call this compilation.
> I cannot decipher from the article the exact expressive power.
To me it seems to suggest being able to parse (exactly) all context-free languages.