4.2 Exercise
4.2.1
Consider the context-free grammar:
S -> S S + | S S * | a
And string aa + a *.
1. Given this string of a leftmost derivation
2. Given this string of a rightmost derivation
3. Given this string of a parse tree
4. ! Whether this grammar i
Chapter 4 Highlights
! Difference LR (0), SLR, LR, LALR between
p157: LR (0) automaton is how to make the shifted - Statute of the
decision? Suppose grammar symbol string such that LR (0) automaton
running from the start state 0 to a state j, then if the
Section 4.6 Exercises
4.6.1
The following describes all possible prefix grammar
1. Exercise 4.2.2-1 grammar S-> 0S1 | 01
2. ! Exercise 4.2.1 grammar S-> SS + | SS * | a
3. ! Exercise 4.2.2-3 grammar S-> S (S) S |
answer
The following extract common facto
4.5 Exercise
4.5.1
For Exercise 4.2.2 (a) of the grammar S -> 0 S 1 | 0 1, pointed out that each
sentence rightmost handle below.
1. 000111
2. 00S11
answer
1. 01
2. 0S1
4.5.2
4.2.1 For practice grammar S -> SS + | SS * | a rightmost and below each
sentenc
5.1 Exercise
5.1.1
Figure 5-1 for the SDD, gives the following expression corresponding to the
annotation parse tree
1. (3+4)*(5+6)n
2. 1*2*3*(4+5)n
3. (9+8*(7+6)+5)*4n
answer
1. (3+4)*(5+6)n
2. 1*2*3*(4+5)n
5.1.2
Extended FIG 5-4 SDD, so that it can hand
5.4 Exercise
5.4.1
We mentioned in section 5.4.2 may be based on LR parsing stack status to
deduce what this status means that grammar symbols. How do we derive
this information?
answer
See Algorithm 4.44
5.4.2
Rewrite the following SDT:
A -> A cfw_a B |
4.7 Exercise
4.7.1
4.2.1 to practice grammar S -> SS + | SS * | a structure
1. Specification LR Itemsets family
2. LALR Itemsets family
4.7.2
To practice each grammar 4.2.2-1 ~ 4.4.2-7 4.7.1 of repetition
! 4.7.3
4.7.1 to practice grammar, using an algori
4.4 Exercise
4.4.1
To each of the following grammar analyzer design of a prediction, the
prediction given analysis table. It may be necessary for you to extract left
factored grammar or eliminate left-recursive operation.
Exercise 4.2.2 1-7 in grammar.
an
4.3 Exercise
4.3.1
Below is a symbol that contains only a and b of the regular expression
grammar. It represents the character using the + and replace operations |, to
avoid grammar and symbols used as the vertical element of confusion:
rexpr -> rexpr + r