4/2/2018 1
MA/CSSE 474
Theory of Computation
Summary of regular Language Algorithms Intro to Grammars Context-free Grammars (CFG)
Your Questions?
- Previous class days'
material
- Reading Assignments
- HW 8 or 9 problems
- Exam 2
- Anything else
MA/CSSE 474 Theory of Computation Summary of regular Language - - PDF document
4/2/2018 MA/CSSE 474 Theory of Computation Summary of regular Language Algorithms Intro to Grammars Context-free Grammars (CFG) Your Questions? Previous class days' material This one Reading Assignments has so many levels
L(M3) = L(M2) L(M1).
L(M3) = L(M2) L(M1).
L(M*) = (L(M))*.
L(M*) = L(M).
L(M3) = L(M2) L(M1).
L(M3) = L(M2) - L(M1).
L(M*) = (L(M))R.
letsub(L(M)).
A rewrite system (a.k.a. production system or rule-based system) is:
Each rule has a left-hand side (lhs) and a right hand side (rhs) Example rules:
lhs means "left-hand side" rhs means "right-hand side"
Replace the first T Replace the second T
May stop when:
none of them is the left-hand side of any rule in the grammar. In this case, we have a blocked or non-terminated derivation but no generated string. Example:
It is possible that neither (1) nor (2) is achieved. Example: G contains only the rules S Ba and B bB, with S the start symbol. Then all derivations proceed as: S Ba bBa bbBa bbbBa bbbbBa ...
Generates Accepts
No restrictions on the form of the right-hand side. S abDeFGab But we require single non-terminal on left-hand side. S but not ASB
x G y iff x = A and A is in R y = w0 G w1 G w2 G . . . G wn is a derivation in G. Let G* be the reflexive, transitive closure of G. Then the language generated by G, denoted L(G), is: {w * : S G* w}. A language L is context-free if there is some context-free grammar G such that L = L(G).
Regular grammar FSM: grammartofsm(G = (V, , R, S)) =
create a new state labeled #.
X to Y labeled a.
to # labeled a.
FSM Regular grammar: Similar. Essentially reverses this procedure. S bS, S aT T aS, T b, T ε