Professional Documents
Culture Documents
Context Free Grammar & Parser
Context Free Grammar & Parser
Context Free Grammar & Parser
& Parser
Context Free Grammar
Declaration Statement
S D V ;
D int | float | char
V V , id | id
Simple If Statement
S If ( Cond) { Stat }
Cond id Relop id
Relop < | > | <= | >=
Stat id = Exp
Exp Exp + Exp | Exp – Exp | Exp * Exp | id
Simple If Statement with else block
Bottom up Parsers
Bottom up parser start with leaf nodes or terminal
symbols, moves upwards till the root node or start
symbol is explored.
Example of Top Down Parser
a) Recursive Descent Parser
b) Table Driven or Predictive Parser