Posted by : Andreas Kwan
Senin, 13 Oktober 2014
14. Draw parse trees for the sentences aabb and aaaabbbb, as derived from the grammar of Problem 13
15. Convert the BNF of Example 3.1 to EBNF.
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.
<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
S -> A | AX
X -> bA | bAX
A -> aA | abA
18. What is the difference between an intrinsic attribute and a nonintrinsic synthesized attribute?X -> bA | bAX
A -> aA | abA
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.
A bubble sort on int array c sorting example codes
BalasHapus