Week3
Barbara Cooper
Due: Friday October 12th during scheduled recitation time.
Construct a BNF grammar to
function as a vending machine. This vending machine charges 50 cents for its
products, and only accepts exact change (if 55 cents is given, it would not
accept any of the money). In other words, the BNF should recognize strings such
as:
quarter dime nickel dime
half_dollar
nickel nickel quarter dime nickel
The resultant BNF should be as efficient as possible, with no unnecessary rules. Pick a method of parsing and show how a few different sample strings would be handled ( both correct strings and incorrect strings).
David Zayas
Cong Truong
Due: Friday October 12th during scheduled recitation time.
Selecting two different programming languages such as C and Fortran, write a simple parsing program for a given grammar and apply it to example sentences such as “The dog walks”, and compare how the implementation affect their ability to parse sentences and check it for grammatical correctness against the given grammar.
You two may focus on different aspects respectively.
Due: Friday October 12th during scheduled recitation time.
Write an LL Parse that take a BNF description and a string and tell the user if the string match the grammar or not.
Due: Friday October 12th during scheduled recitation time.
Discuss LL(1) parsing grammar. How the grammar works? Sow how it is implemented in some programming language .
Due: Friday October 12th during scheduled recitation time.
Find a BNF description of Java’s syntax. Show that the Java syntax for the if-statement eliminates any ambiguity. That is, draw the parse tree of the following program skeleton (but now using Java’s correct syntax).
if (C1) if (C2) S1; else S2;
And argue that no other parse tree can be found using the Java BNF rules. Compare this syntax approach to C and Ada.
Daniel Sutton
Due: Friday October 12th during scheduled recitation time.
Discuss BNF and EBNF and the difference of them. How to translate EBNF into BNF?
Stavros Michaelides
Due: Friday October 12th during scheduled recitation time.
Lisp is often times described as a special-purpose language used in the field of artificial intelligence. How is Lisp more of a special purpose language than others such as C or C++?