1Question 1
Using the
grammar in Example 3.2 [p.117]*,
draw a parse tree for each of the three following statements:
Attach your
parse trees as a single jpg or gif file.
●
A = A * (B +
(C * A))
●
B = C * (A *
C + B)
● A = A * (B + (C))
Using the
grammar in Example 3.2 [p.117]*,
show a sentential form leftmost
derivation for each of the three following statements.
Write your
derivation steps in the answer space below:
Note: These are the same three statements as
the previous questions.
●
A = A * (B +
(C * A))
●
B = C * (A *
C + B)
● A = A * (B + (C))
Using the
grammar in Example 3.4 [p.120]*,
draw a parse tree for each of the four following statements:
Attach your parse trees as a single jpg or gif file.
●
A = ( A + B
) * C
●
A = B + C +
A
●
A = A * (B +
C)
● A = B * (C * (A + B))
Using the
grammar in Example 3.4 [p.120]*,
show a sentential form leftmost
derivation for each of the four following statements.
Write your
derivations in the answer space below:
Note:
These are the same four statements as the previous questions.
●
A = ( A + B
) * C
●
A = B + C +
A
●
A = A * (B +
C)
● A = B * (C * (A + B))
Prove that
the following BNF grammar is ambiguous.
Attach your parse trees as a single jpg or gif file.
<S> → <A>
<A> → <A> + <A> | <id>
<id> → a
| b | c
Describe, in
English, the language defined by the following grammar:
S → ABC
A → aA | a
B → bB | b
C → cC | c
Consider the
following grammar:
<S> → <A> a <B> b
<A> → <A> b | b
<B> → a
<B> | a
Which of the
following strings are in the language generated by this grammar?
|
|
bbaab |
|
|
baab |
|
|
bbaaaaa |
|
|
bbbab |
Consider the
following grammar:
S → aScB | A | b
A → cA | c
B → d
| A
Which of the
following sentences are in the language generated/recognized by this grammar?
|
|
acccbd |
|
|
acd |
|
|
acccbcc |
|
|
accc |
|
|
cd |
|
|
abcd |
Convert the
following EBNF rules to BNF:
S → A{bA}
A → a[b]A
Note: These rules are an incomplete
grammar. You are responsible only for converting the given rules (partial
grammar).
Write EBNF
descriptions (i.e. rules) for the a Java
class definition header statement.
● Begin with the start symbol <class_header>.
● Use the non-terminal <class_name> for the
user-defined name of the class
● You do not have to include a LHS rule which
defines valid naming conventions to expand the <class_name> non-terminal
Get Free Quote!
365 Experts Online