b. Discussion: Which of the above should you have (or not have) in your Language Reference Manual? Why?
c. Who needs to read language descriptions? List names of types of people.
d. What was BNF used for? What does BNF stand for? Who developed it?
e. What was EBNF used for? What does the E in EBNF stand for?
f. Give an example defining the same simple piece of syntax in BNF and EBNF that shows how they differ.
2 << 3
16 >> 2
cout << 3
cin >> xUsing the books BNF express this description:
More TBA...
b. Give an XBNF definition* of a C/C++/Java while statement in terms of expression and statement.
c. Translate your previous answer into BNF definitions in terms of <expression> and <statement>.
d. Show parse trees for each of your examples using your BNF. If any don't fit, either revise the example of the XBNF and BNF.
b. Give some XBNF definitions that define a C/C++/Java if statements in terms of expression and statement. The definitions must define the syntax of both the if and if-else alternative forms.
c. Translate your previous answer into BNF definitions using <expression> and <statement>.
d. Draw the parse trees for each of your 5 examples using your BNF.
e. If any don't fit, either revise the example of the XBNF and BNF.
1*2
1*2+3
1*2+X*Y+4*a*c
2+1*(1+2*3)
4*a*c
4
a
(1+2*3)
(1*2+X*Y+4*a*c)
(2+1*(1+2*3))
Note: this is a very common pattern in syntax descriptions that defines the precedence of operators.
See [ Answer 4 ] below.
(I have put this in previous finals.... however you won't be able to answer it until the end of your project)
1*2
1*2+X*Y+4*a*c
1+2*3
2+1*(1+2*3)
4*a*c
4
a
(1+2*3)
(1*2+X*Y+4*a*c)
(2+1*(1+2*3))
. . . . . . . . . ( end of section Answers) <<Contents | End>>
. . . . . . . . . ( end of section CS320/04 Questions on Defining Languages) <<Contents | End>>