vnmakarov / yaep

Yet Another Earley Parser
Other
133 stars 13 forks source link

dynamic rule creation #1

Open ghost opened 8 years ago

ghost commented 8 years ago

Hi there. Great work! (too many c++only runtime parser generators out there)

Is there any chance to easily create rules at runtime? I mean, earley_parse_grammar(g, description) accepts string as grammar description for now, but I would like to fill some BNF-shaped (recursive) struct and use it in hypothetic earley_load_grammar(g, myBNF). I could create a patch myself, but I'm not sure my parser-generator background is strong enough to just start without any hints. Thanks!

vnmakarov commented 8 years ago

Thanks.

You can generate description string at runtime and use earley_parse_grammar.

You can also use function yaep_read_grammar providing functions read_terminals and read_rules. If this interface is still not convenient for you, learning code of yaep_read_grammar could be a start point.