|
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
Due Oct.11 (Wed) 15:00
Your name and the assignment-number must be in a comment at the start of the file, along with a link to this assignment page.
I encourage you to actually put all the nonterminals in upper-case (or at least first-letter-upcased), just to make it easier to tell terminals from non-.
<JsFunc> → function <JsIdent>( <JsIdents> ) { <JsStmts> } |
For the grammar rules, write them as in class: in basic BNF
using “→” (and “
(2pts)
As we consider how to define
Working towards a solution, the programmer MC Carthy comes up with the following attempt for a nonterminal that generates comma-separated lists of “x”s (albeit still ending in a semicolon, unlike our part (c) next):
<XS> → ; | x; | x, <XS> |
Prove that this grammar is not correct, by giving a derivation2 of some string which is not a valid comma-separated list (ending in a semicolon).
(6pts) Generating a grammar
Give a grammar for Java's boolean expressions.
(That is: a grammar describing exactly what you are allowed to put
inside the parentheses of a Java
For this problem, assume that you already have grammar rules for
a Java numeric expression
(“
Using your grammar, give a parse tree (not a derivation) for:
In the tree, for children of
home—lectures—recipe—exams—hws—D2L—breeze (snow day; distance)
©2017, Ian Barland, Radford University Last modified 2017.Oct.25 (Wed) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |