Closed xigoi closed 3 years ago
Hi Adam, Is this helpful? https://github.com/zevv/npeg/blob/master/misc/indent.nim
Thanks! It's amazing how flexible npeg is. Maybe it would be good to mention this in the documentation.
Quoting Adam Blažek (2021-06-12 17:36:31)
Hi Adam, Is this helpful? https://github.com/zevv/npeg/blob/master/misc/indent.nim
Thanks! It's amazing how flexible npeg is. Maybe it would be good to mention this in the documentation.
Sure, I'll add a note to the documentation mentioning how amazingly flexible npeg is :)
Many languages, including Nim, use indentation to represent a tree structure. Would it be possible to add a mechanism for parsing such languages into NPEG? Indentation-based grammars are not strictly context-free, but it's quite easy to convert them into a context-free grammar by introducing special “indent” and “dedent” tokens, representing a change in the indentation level, which can then work like brackets.