SPCC Module 5 Lect 5 Syntax Analysis Part 1.Pptx
SPCC Module 5 Lect 5 Syntax Analysis Part 1.Pptx
LECTURE 1
Source
Program Parse Intermediate
token
Tree Representation
Lexical Semantic
Parser
Analyzer Analyzer
◼ It obtains a string of tokens from the lexical analyzer and verifies that
Symbol the string can be generated by the grammar for the source language
Table
◼ It also reports any syntax errors
◼ Now find a parse tree for a related string y with the help of an
Steps:
Rightmost Derivation
Here, rightmost Non-Terminal is replaced in every step.
Context
Free E→(E)
Grammar E → (E+E)
E→ (E+E*E)
E→ (E+E*id)
E→(E+id*id)
E→(id+id*id)
Steps:
Leftmost Derivation
Free
Grammar E→(E)
E→(E*E)
E→ (E+E*E)
E → (id+E*E)
E → (id+id*E)
E→(id+id*id)