Context free Grammars
Context free languages are used in parser design. They play a vital role in compiler construction as well as in describing the block structure in the programming languages.
A CFG is a quadruple (N, T, P, S).
N: Non terminal symbols
T: Terminal symbols
P: Prodcution rules
S: Start symbol
To generate a string start with the start symbol. Than replace the non termial symbols with terminals or non terminal symbols. Repeat the process untill all the nont terminals have been replaced by the terminals.
Example:
CFG:
S--> aABS
A-->a
B-->b
In this exammple,
N:= {S,A,B}
T:= {a,b}
P:= {S-->aABS, A-->a, B-->b}
S: = {S}
Related topics :
- Definition of DFA
- DFA notations
- How DFA process inputs
- DFA solved examples
- Minimization of DFA
- Definition of NFA
- Equivalent of DFA and NFA
- Properties of transition functions
- Trape/ Dead state
- Moore machine
- Mealy machine
- Mealy to Moore machine conversion
- Moore to Mealy machine conversion
- Difference between Mealy and Moore machine
- Regular expression
- Regular expression examples
- Regular expresstion to CFG
- Regular expression to Regular grammar
- Ambiguous grammar
- Leftmost and Rightmost derivations
- Arden's Law
- NFA with ∈ moves
- Construct NFA without ∈ moves
- NFA with ∈ to DFA Indirect method
- Context Free Grammars
- Convert CFG in to CNF
- CFL are not closed under intersection
Post a Comment
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.