CPSC 425 Spring 2006
HW 2: More Grammars and Syntax
Read Webber sections 3.1-3.4.
- Exercise 3.1 (a), (b), (c)
- Go to the online Java Language Specification at
http://java.sun.com/docs/books/jls/second_edition/html/j.title.doc.html,
and use this document to answer the following questions. (You may find
the index helful.)
Answer each with an English explanation, but
refer to the grammar productions that support your answers.
- What is the structure of a Java identifier?
- Which of the following statements is/are legal in Java?
- x;
- 5;
- x=z=y;
- Which has higher precedence, && or ||?
- Go to http://www.99-bottles-of-beer.net. This site contains programs in 880 different languages
to print all verses of the song "99 bottles of beer on the wall." Browse
through some of them and choose a version in a language you don't know
that is very different from Java. Print the program, then find out enough
about the language (many of the pages have links to pages that describe
the languages) to understand how the program works. Write this
explanation (do not just print pages from the language manual; explain
what is going on in your actual program) and be prepared to explain
it to the class.