Professional Documents
Culture Documents
Context-Free Grammars
Context-Free Grammars
Context-free syntax is
specified with a
grammar, usually in
Backus-Naur form (BNF)
1.
2.
3.
4.
5.
6.
7.
<goal> := <expr>
<expr>:= <expr> <op> <term>
|
<term>
<term>
:= number
|
id
<op> := +
|
A grammar G = (S,N,T,P)
S is the start-symbol
N is a set of non-terminal symbols
T is a set of terminal symbols
P is a set of productions P: N (N T)*
Oscar Nierstrasz
Compiler Construction
Regular Languages
Let L(A) be a language recognized by
a DFA A.
Then L(A) is called a Regular
Language.
qj
qk
11/15/15
NFA Construction
Automatic construction example
a(b*c)
a(b|c+)?
Build
Build aa Disjunction
Disjunction
Conversion Example
continued
(4)table for the DFA of:
This gives the transition
Input Symbol
State
C
D
C
E
C
A
B
C
D
E
B
B
B
B
B
b
C
b
start
B
a
D
a
b
a