FAFL Final Lecture 23.2 CMH
FAFL Final Lecture 23.2 CMH
Lecture 23.2
Parse Trees
S c h o o l o f C o m p u t i n g a n d I n f o r m a t i o n Te c h n o l o g y
Chaithra M H
Assistant Professor
AY:2020-2021
OUTLINE
Lecture Discussion
• Finite Automata
Course Description
• Transition Diagram
Finite • Configuration of Finite Automata
Automata • Language Accepted and Rejected by FA
• Transition Function (δ)
• Deterministic Finite Automata - Definition
Parse Trees
To p i c o f t h e L e c t u r e
TOPIC OF THE LECTURE
Example 1- Consider the grammar shown below and construct the parse tree having a string w=
a*b+c
T T + T | T * T
T a|b|c
b c
PARSE TREE - EXAMPLES
Example 2- Consider the grammar shown below and construct the parse tree
having a string x = a * b + c
Z→Z+Z|Z*Z|a|b|c
Solution Z Parse tree
Left most derivation :
Z →Z+Z Z + Z
→Z*Z+Z (Using Z Z * Z)
→a*Z+Z (Using Z a) Z * Z
c
→a*b+Z (Using Z b)
→a*b+c (Using Z c) a b
Parse Trees
Yi e l d o f a T r e e
YIELD OF A TREE
Example - Consider the grammar shown below and construct the parse tree
having a string w = a * b + c
I→I+I|I*I|a|b|c
Solution I Parse tree
Left most derivation :
I →I+I
I + I
→I*I+I (Using II*I)
→a*I+I (Using Ia) I * I
c
→a*b+I (Using Ib)
→a*b+c (Using Ic) a b
Reading a leaf nodes from left to right (leaving ԑ-symbols is any), is said to be Yield
of a tree
DISCUSSION
5 MINUTES
SUMMARY OF THE LECTURE
“All of you have to give quiz where there will be 8 questions covering part1 and part 2 of
lecture. It is compulsory as it is used for assessment and attendance”
QUIZ
Questions from Lecture 23.1 & 23.2
1. Output of parser is
A) parser B) LMD
QUIZ
Questions from Lecture 23.1 & 23.2
A) Equal number of 0’s and 1’s B) Any number of 0’s and 1’s