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 production p := empty | expr p empty represents empty string.

  • [ expr ] can replaced inserting p := empty | expr.

  • any expression ( expr ) can replaced adding new production p := 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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -