Problem Set :
a=Answer
14. Draw parse trees for the sentences aabb and aaaabbbb, as derived from the grammar of Problem 13
a.
15. Convert the BNF of Example 3.1 to EBNF.
a.
EBNF:
<program> → begin <stmt_list> end
<stmt_list> → <stmt> { ; <stmt_list>}
<stmt> → <var> = <expression>
<var> → A | B | C
<expression> → <var> { (+|-) <var>}
16. Convert the BNF of Example 3.3 to EBNF.
a.
<assign> → <id> = <expr>
<id> → A | B | C
<expr> → <expr> {(+ | *) <expr>}
| <id>
17. Convert the following EBNF to BNF:
S → A{bA} A →
a[b]A
a.
S -> A | AX
X -> bA | bAX
A -> aA | abA
X -> bA | bAX
A -> aA | abA
a. An intrinsic attribute is an inherent characteristic of a terminal symbol in the grammar. So the value of the attribute is determined solely from the terminal symbol. A nonintrinsic synthesized attribute is an attribute of a non-terminal symbol in the grammar.
No comments:
Post a Comment