(1 × 15)
| (1) | ⋖ | (2) | ⋖ | (3) | ⋖ | (4) | ⋗ | (5) | ⋖ |
| (6) | ⋗ | (7) | ⋗ | (8) | ✘ | (9) | ⋖ | (10) | ⋗ |
| (11) | ⋗ | (12) | ⋗ | (13) | ⋖ | (14) | ⋗ | (15) | ⋗ |
(2 × 4, 6, 3, 4, 4, 4, 8, 8)
| (1-ⅰ) | id { id } など |
(1-ⅱ) | ✘ |
| (1-ⅲ) | id { id - { id ! id { id } } } など |
(1-ⅳ) | id { { id ! id { id } } } など |
| (2) | \(\begin{array}{lcll} S & \rightarrow & {\color{red}\textbf{id}\ \texttt{\{}\ E\ \texttt{\}}\ S'} & {\color{red}\cdots ①}\\ \\ S' & \rightarrow & {\color{red}\texttt{;}\ \textbf{id}\ \texttt{\{}\ E\ \texttt{\}}\ S'} & {\color{red}\cdots ②}\\ & | & {\color{red}\varepsilon} & {\color{red}\cdots ③}\\ \\ \\ E & \rightarrow & {\color{red}F\ E'} & {\color{red}\cdots ④} \\ \\ E' & \rightarrow & {\color{red}\texttt{+}\ F\ E'}& {\color{red}\cdots ⑤} \\ & | & {\color{red}\texttt{-}\ F\ E'}& {\color{red}\cdots ⑥} \\ \ & | & {\color{red}\varepsilon} & {\color{red}\cdots ⑦} \\ \\ \end{array}\) | |||||||||||||||||||||||||||||||||||||||||||||
| (3) | id, { | |||||||||||||||||||||||||||||||||||||||||||||
| (4) | $, } | |||||||||||||||||||||||||||||||||||||||||||||
| (5) | }, ! | |||||||||||||||||||||||||||||||||||||||||||||
| (6) |
|
|||||||||||||||||||||||||||||||||||||||||||||
| (7) |
|
| (8) |
void E(void) {
switch (token) {
case ID: case '{': F(); E1(); break;
default: reportError();
}
}
void E1(void) {
switch (token) {
case '+': eat('+'); F(); E1(); break;
case '-': eat('-'); F(); E1(); break;
case '}': case '!': break;
default: reportError();
}
}
|
(5 × 4)
| (1) | (E) | (2) | (J) | (3) | (L) | (4) | (Q) |