lua-users home
lua-l archive

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


Wow, good job!

If I understand correctly, your code contains parser for string with
LPEG grammar and executor for parsed grammar, which returns AST.

I've implemented similar executor (which is used in "lcf" (lua code
formatter and "autoldoc") but my grammars passed as lua table.

Do your parser-gen have hard limits? And under what license it is
distributed?

-- Martin
Thank you, Martin.

I'm not exactly sure what you mean by executor. The tool works in this way:

1) the PEG grammar is parsed in peg-parser.lua to create an AST of the grammar (grammar AST)
2) the grammar AST is modified to add space handling, error labels, captures etc. in parser-gen.lua
3) the grammar AST is compiled into an LPeg grammar, which is returned to the user. The user can then use this LPeg grammar to parse a string. If the automatic AST building is enabled, this will result in an AST of the input string, otherwise, the farthest match or any captures. See the Tiny parser example in the GitHub page: https://github.com/vsbenas/parser-gen#example-tiny-parser

The only hard limits are the ones inherited from the LPegLabel library - the LPeg stack size (which can be increased) and the 255 error label limit.

The tool is released under MIT/X11 license.

Ben