Compiler Lecture 10
Compiler Lecture 10
1. Quiz
2. Parsing
3. Parsing Technique(LL1 Grammar)
4. Parsing Table Construction Technique
5. Examples
6. Exercises
Objective and Outcome
Objective:
• To provide an overview of parsing and parsing types.
• To give an overview of predictive parser
• To demonstrate the predictive parsing table construction for predictive / LL(1)
parser from a given CFG
Outcome:
• After this lecture the students will be able to understand basics of predictive
and LL (1) parser.
• The students will be capable of constructing a predictive parsing table from
given CFG
Quiz
▪Quiz
Parsing
▪ The process of determining if a string of terminals (tokens) can be generated by a
grammar.
▪Time complexity:
▪ For any CFG there is a parser that takes at most O(n3) time to parse a string of n
terminals.
▪ Linear algorithms suffice to parse essentially all languages that arise in practice.
Consider the following LL(1) grammar, which has the set of terminals T = fa; b;
ep; +; *; (; )g. This grammar generates regular expressions over fa, bg, with +
meaning the RegExp OR operator, and ep meaning the ε symbol. (Yes, this is a
context free grammar for generating regular expressions!)
Parsing Table Construction (Solution)