Slide 2.3: The Chomsky hierarchy (cont.) Slide 2.5: Context-free grammars Home |
<number> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0<number> | 1<number> | 2<number> | 3<number> | 4<number> | 5<number> | 6<number> | 7<number> | 8<number> | 9<number>A context-free grammar of simple arithmetic expressions could be
<E> ::= <E> + <T> | <E> – <T> | <T> <T> ::= <T> * <F> | <T> / <F> | <F> <F> ::= ( <E> ) | <number>The Chmosky hierarchy shows every regular set is a context-free language.
an
| n
is an integer ≥ 0}
<A> ::= a <A> | ε
(()(()))()
” is
<A> ::= ( <A> ) <A> | ε