Computer Science Department
Programming Methods Laboratory

Compilation     winter 99/00
Ecole Polytechnique Federale de Lausanne
Assignment 1
05.11.1999

Write a Scanner for the language J0! The token classes are ident, number, and string plus the tokens used explicitly in the grammar.
  ident         = letter { letter | digit }.
  number        = digit { digit }.
  string        = "\"" { stringchar } "\"".
where
  stringchar    = escapechar | plainchar.
  escapechar    = "\\" char.
  plainchar     = charNoQuote.
  char          = << any printable character >>.
  charNoQuote   = << any printable character except "\"" and "\\" >>.
  letter        = "a" | ... | "z" | "A" | ... | "Z" | "_".
  digit         = "0" | ... | "9".
Your scanner should be able to accept C++/Java-style comments; i.e. line comments starting with // and ending at the end of the line and comments enclosed in /* and */.

The assignment is due on Friday, 19.11.99.

Tutorial for Programming Language Implementation, 05.11.99