Chapter 4 Flashcards
1
Q
When analyzing a program for syntactical correctness, what are the two major steps?
A
- Lexical analysis
- Syntactical analysis
2
Q
Why are these two steps usually separated?
A
- Reduce complexity
- Increase efficiency
- Allow for reuse (functions)
3
Q
What are the two major approaches to syntax analysis?
A
- Top-down parsing
- Bottom-up parsing
4
Q
What is the most common top-down parsing method? What is the short-coming of this approach?
A
Recursive descent. Limitation of leftmost recursion (A → A | B).
5
Q
What is the most common bottom-up parsing algorithm?
A
The LR (left-to-right, rightmost derivation) algorithm.