Professional Documents
Culture Documents
Formal Grammars Real
Formal Grammars Real
Eg.
A=
{a,b,c,d,e,f,g,h,I,j,k,l,m,n,o,p,q,r,s,t,u,v,
w,x,y,z}
A = {a,b,c}
A = {0, 1}
A = {+,-,*,/}
Eg.
A = {a,b,c}
w=a w=b
w=c
w = aa w = abc w = ccc
Denotes
w=
Denotes
w
w
w
w
=
=
=
=
abcd
0 /w/
12 /w/
/w/
/w/ = 4
=1
=2
=0
Fundamental
operation on strings
= .
Where
is the prefix of and is a
proper prefix if while
is the suffix of and is a
proper suffix if
Any
denotes
k copies of w
Given w = abc
w3 = 3 copies 0f w
= abcabcabc
Is
SLE
L V :=
E if B then A
else E
EA
BA<A
BA=A
AT+A
AT
TV
T0
T1
T (E)
Vx
Vy
3.
N
T
P
It
is a four-tuple
G = (N, T, P, )
Where
N is a finite set of nonterminal
symbols
T is a finite set of terminal symbols
N and T are disjoint: N T =
P is a finite set of productions
is the sentence symbol; (NT)
Given a G an L can be
derived
Occurs
Structural
Labeling
N = {A,B,S}
1.
S
S ScS
Sc
2. A B A
Aa
Ab
Ac
B+
B*
TYP
E
FORMAT OF
PRODUCTIONS
REMARKS
Unrestricted
Substitution Rules
Contracting
A,
A ,
Context Sensitive
NonContracting
Context Free
NonContracting
A aB
Regular, Right
Linear
Aa
A Ba
Regular, Left Linear
Aa
AN {}, , and (N T)*, B N, a T
NonContracting