Pegged, From EBNF to PEG
bls
bizprac at orange.fr
Mon Mar 12 05:43:06 PDT 2012
On 03/10/2012 03:28 PM, Philippe Sigaud wrote:
> Hello,
>
> I created a new Github project, Pegged, a Parsing Expression Grammar
> (PEG) generator in D.
>
> https://github.com/PhilippeSigaud/Pegged
>
> docs: https://github.com/PhilippeSigaud/Pegged/wiki
Just WOW!
Nice to have on your WIKI would be a EBNF to PEG sheet.
Wirth EBNF Pegged
A = BC. A <- B C
A = B|C. A <- C / C
A = [B]. A <- B?
A = {B}. A <- B*
Having EBNF expressed in Pegged ...
EBNF <- Procuction+
Production <- Identifier '=' Expression '.'
Expression <- Term ( '|' Term)*
Term <- Factor Factor*
Factor <- Identifier /
Literal /
'[' Expression ']'
/ '{' Expression }'/
'(' Expression ')'
lowerCase <- [a-z]
upperCase <- [A-Z]
Identifier <- (lowerCase / upperCase) (lowerCase / upperCase)*
Literal <- ("'" .+ "'" / '"' .+ '"')
Due to the fact that EBNF can be expressed in EBNF it should be possible
to parse an arbitrary EBNF file and generate PEG output.
What do you think ?
BTW.. Is my EBNF PEG description correct ? TIA Bjoern
More information about the Digitalmars-d-announce
mailing list