SE 550: Homework

Deadline: 5.30pm, Tuesday, 27 January, 2004

Homework

1. Describe in English the language accepted by the following grammar:

  <tag> ::= begin <name> ( <tag> | <text> )* end
  <name> ::= this | that
  <text> ::= ( hello | world )+

2. Is the grammar in part 1 in BNF? If not, convert it to BNF.

3. Is the grammar in part 1 in LL(1)? If not, convert it to LL(1).

4. Imagine a client/server system where clients could send requests to find out whether a user is logged on to a server. Sample messages include:

  C> USER ajeffrey
  S> ON SINCE Thu Sep 20 10:37
  C> USER bjeffrey
  S> NOT ON
  C> USER cjeffrey
  S> NO SUCH USER
  C> QUIT
  S> OK

Specify this protocol as a BNF LL(1) grammar, including nonterminals <request> for client requests and <response> for server responses.

Submit your answers as a plain text file hw-week3.txt using Courses OnLine.

Reading

Metamata/Webgain/Sun's JavaCC documentation.