tadzik / Grammar-BNF

Parse BNF and ABNF grammars and generate Perl 6 grammars from them
MIT License
16 stars 5 forks source link

Handle 0 or more quantifier #3

Open MattOates opened 9 years ago

MattOates commented 9 years ago

For example ::= {} or ::= * I'm dealing with a grammar that does {}* but I think that is just quirky.

skids commented 9 years ago

That may be an EBNF grammar? There's no quantifier like that in strict BNF (in fact [ ] is only marginally part of the standard.)

ruoso is working on EBNF here: https://github.com/ruoso/Grammar-EBNF, but as to when he'll either ask tadzik to merge here or put Grammar::EBNF into the ecosystem you'd have to ask him.

Also you may subclass grammars, and by doing so override rules to add that for a nonstandard metasyntax.

tadzik commented 9 years ago

Yeah, as @skids says, the BNF I implemented here (since there is no standard for it that I know of) was not supposed to have zero-or-more. EBNF does have that feature though; maybe that's what you need to use here, @MattOates? Or is there something in your grammar that doesn't work with EBNF?

Since BNF has no formal standard that I know of, I think I'd rather support what people actually use and encounter in real world grammars rather than strictly sticking to wikipedia standard which I did initially, so please let me know :)