Specific conversion of EBNF into BNF -
<a> ::= <b> x {<b> <d>} y <b> <b> ::= <c> (w|z) <c> <d> <c> := m [n] <d> <e> <d> := q | null <e> := p | null
how convert ebnf bnf?
different people use different syntax ebnf, , i'm not sure 1 using. grammar in ebnf (iso/iec 14977: 1996(e)) this:
a = b, "x", {b, d}, "y", b; b = c, ("w" | "z"), c, d; c = "m", ["n"], d, e; d = ["q"]; e = ["p"];
assuming use null
empty string. notice further simplified.
some productions must added convert bnf:
{ expr }
can replaced inserting productionp := empty | expr p
empty
represents empty string.[ expr ]
can replaced insertingp := empty | expr
.any expression
( expr )
can replaced adding new productionp := expr
.
so this:
a -> b x f y b f -> empty | b d f b -> c g c d g -> w | z c -> m h d e h -> empty | n d -> q | empty e -> p | empty
again, assuming null
mean empty string.
Comments
Post a Comment