| Lab | Assigned | Lab Due (Start of class) |
||
|---|---|---|---|---|
| 4 | Feb | 20 | Feb | |
Any argument could itself be a parenthesized, prefix expression. The string
| Expression | Meaning |
| (plus a b) | a + b |
| (minus a b) | a - b |
| (negate a) | - a |
| (sum a1 a2 ... aN) | sum of a1 through aN |
| (product a1 a2 ... aN) | product of a1 through aN |
| (mean a1 a2 ... aN) | (sum of a1 through aN) divided by N |
Make sure they are saved as .jar files! Internet Explorer tried to save them as zip files in CEC
Put them in a reliable place (for example,because you'll need to reference them from the ant build file.
Windows Linux Mac OS X C:\CS431Tools\ /usr/lib/ /Library/431Tools/
Eclipse, in its eagerness, has probably already tried to compile your project, but there are some automatically generated files that are missing, because we haven't really built the project yet.
Silly eclipse.So don't worry about problems just yet.
This makes eclipse's internal Java compiler available to the build process.
This makes eclipse aware of the new files generated by the build process (the scanner and parser).
Go ahead and try that.
| RecursiveDescent.java | The skeleton for your predictive parser. |
| addhaque.cup | The CUP grammar specification file. |
| TestFiles | The directory of test files for this project |
| tdn.java | Contains the main for your top-down (recursive-descent) parser |
| bup.java | Contains the main for your bottom-up parser |
Something you need to know: A Symbol type has two components:
To turn in this part, send mail to legrand@cs.wustl.edu with the subject line 'homework 2a lastname_firstname', and attach your RecursiveDescent.java
To turn in this part, send mail to legrand@cs.wustl.edu with the subject line 'homework 2b lastname_firstname', and attach your addhaque.cup
| CUP specification for AddHaque: addhaque.cup | |
import java_cup.runtime.*; import hw2.*; import Common.Listing; terminal Integer number; terminal plus, minus, sum, product, times, negate, mean; terminal lparen, rparen; non terminal Integer Program, File, Lists, List, Expression; non terminal Integer Atom, Operand, Operands; start with Program; |
Program ::= File ; File ::= Lists ; Lists ::= Lists List | List ; List ::= lparen Expression rparen ; Expression ::= plus Operand Operand | minus Operand Operand | times Operand Operand | negate Operand | sum Operands | product Operands | mean Operands ; Operand ::= Atom ; Operands ::= Operands Operand | Operand ; Atom ::= List | number ; |