CST 8152 - Midterm #2 Review Questions
- What is an ambiguous grammar?
Show that a grammar is ambiguous. (2.2)
- Write a set of grammar productions that
correctly parse a given language.
- Write a set of recursive-descent parsing
functions for a given grammar.
- List and describe various types of error
recovery in a Parser (4.1)
- Write a function that implements panic
mode error recovery in a language that uses ';' to
separate statements.
- What are Aho's three goals of an error
handler in a parser? (4.1)
- Of what use are reserved words to
a predictive parser?
- What are the four components of a Context
Free Grammar? (2.2)
- Show how parse trees for left- and
right-associative grammars differ. (2.2)
- Write a parse tree for a given sentence
and grammar.
- What is a parse tree? (2.2)
- Why not use a CFG to define the lexical
syntax of a language, instead of using regular
expressions? (4.3)
- Describe some methods of error repair and
recovery.
- Describe four error recovery strategies.
(4.2)
Text Readings up to Midterm #2
- Aho sections 2.1, 2.2: parsing, syntax
definition, context free grammars, parse trees,
ambiguity, associativity, precedence
- 2.4: top-down parsing, predictive parsing,
function of lookahead, FIRST sets, designing a predictive
parser
- Recursive Descent parsing functions: Fig
2.24, 2.27, 2.28
- Matching statements by using reserved
words: Fig 2.34
- 4.1: role of the parser, error recovery,
nature of syntax errors
- Parts of section 4.2: Context Free
Grammars, terminology and notation, ambiguity
- Parts of section 4.3: how are grammars
built?
- Parts of section 4.4: recursive-descent
parsing, predictive parsers, transition diagrams
- Error handling: Aho p. 11 and section 4.1