[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [release] parser-gen
- From: Martin <eden_martin_fuhrspam@...>
- Date: Wed, 30 Aug 2017 16:29:16 +0100
On 08/30/2017 04:07 PM, Benas Vaitkevičius wrote:
> Dear Lua community,
>
> I am glad to announce parser-gen, a parser generator that I created
> together with LabLua this summer. The code can be found on GitHub:
> https://github.com/vsbenas/parser-gen
>
> The tool extends the LPeg(Label) module to provide these features:
> 1) generate parsers based on a PEG grammar description (similar to ANTLR
> and re);
> 2) allow easier error description and reporting;
> 3) automatically handle space characters, comments or any other patterns
> set by the user;
> 4) build ASTs automatically based on the rule name;
> 5) generate recovery grammars automatically, build partial ASTs for
> inputs with errors;
> 6) generate error labels for LL(1) grammars.
>
> All these features should make the description of parsers easier, faster
> and more concise. Any of these features can be disabled if necessary
> (for example, to build a custom AST).
>
> The grammars used for this tool are described using a PEG-like syntax,
> that is identical to the one provided by the "re" module, with some
> extensions used in the "relabel" module and "ANTLR" grammars. See a
> working example parser here:
> https://github.com/vsbenas/parser-gen#example-tiny-parser
>
> For a more advanced example check out the Lua parser:
> https://github.com/vsbenas/parser-gen/blob/master/parsers/lua-parser.lua
>
> The package can be installed using luarocks:
> $ luarocks install parser-gen
>
> This is a beta release, please report any bugs when found.
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