WEEK 3
Due Monday 14th October
Section 1
Presentation Time: 8:00 AM
Monday 14th
October
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).
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Section 2
Presentation Time: 9:05 AM
Monday 14th
October
Discuss the impact of programming style on the performance of Scheme programs, eg. recursion or loops, "if-then" or "cond", using assignment or not using it.
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.
Research the automatic garbage collection performed in Java. Find actual benchmarks and test results on its usage. Discuss how such garbage collection affects performance. Have there been improvements in Java's garbage collection? If so, discuss this as well.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Section 3
Presentation Time: 10:10 AM
Monday 14th
October
Discuss BNF and EBNF and the difference of them. How to translate EBNF into BNF?
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.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
Section 4
Presentation Time: 11:15 AM
Monday 14th
October
Obtain a copy of the article "An Empirical Comparison of Seven Programming
Languages" by Lutz Prechelt from _Computer_ magazine, October 2000. You
can get a copy of this magazine from the Library, or Dr. van Engelen can
provide you with one. The article gives comparisons between several
scripting languages, Java, C, and C++.
Divide the article between the team members and discuss the results shown.
Discuss in details the semantics and implementation of exception handling in Java.