Assignment II (Lexical Analysis; Parsing)


Due Oct 24, 1997

Consider the following subset of Verilog called V0 (from Mike Gordon's notes)

Programs     P ::= always S
Statements   S ::= x = exp                          Blocking assignment
                |  x <= exp                         Non-blocking assignment
                |  begin {:label} S; ...; S end     Blocks
                |  disable label                    Jumps
                |  if (exp) S {else S}              Conditionals
                |  while (exp) S                    Loops
                |  forever S                        Infinite Loops
                |  @ S                              Timing Control
Your job is to write a parser for that language. You will need to set your CLASSPATH environment variable as follows:
 setenv CLASSPATH .:/local/apps/Java:/local/apps/Java/CUP 

Here are the supporting files for Java. The only thing you have to do is complete the specifications in Parse/v0.lex and Parse/v0.cup. You don't have to modify anything else, but you are welcome to browse the code and ask questions. Even though the specifications v0.lex and v0.cup are incomplete, the binaries (.class files) are the ones generated from my own parser. In other words, you can run:

 java Main test*.v 
to parse the file test*.v and expect the correct output. Once you compile your own sources, you will obviously overwrite these binaries so you might want to save them somewhere.
Page visited times since November 18, 1996.

sabry@cs.uoregon.edu