milestone: Try out each
toolset on a Tiny example
The purpose of this milestone is to make sure that your group
functions well together, to get each toolset installed and working on
a small example, and to help you compare between toolsets.
For each one of the flex+bison, SableCC 2, and SableCC
expression evaluators, make the following changes:
Include extra tests in the
- Extend the Tiny expressions with an exponentiation operator
**. Note that this operator is right-associative,
i.e. 2**3**4 is to be parsed as 2**(3**4). Also not
that this operator has higher precedence than all other numeric
- Fix the pretty printer to output the minimal number of
required to preserve the semantics of the expression: not too few and
not too many. This should include the exponentiation operator from part
- Introduce a unary minus operator
as syntactic sugar for
This means that unary
minus should be defined in the grammar, but not in the abstract syntax
trees. (In particular you do not
need to extend the pretty printer etc. to include this operator.) This
question is somewhat tricky in SableCC. If using the
version 2 syntax, you need to write a CSTtoAST pass that builds an AST
and in doing so strips out the unary minus. If using the version 3
syntax, there is no way to create a '0' node. You can either a)
create a null node and then use a later pass that replaces it with
zero, or b) perform a post pass that fixes up any unary minus nodes
- The evaluator currently tries to determine the value of the
expression. Fix it to:
- Handle division by constant zero properly. This means
error message should be printed for evaluating
/ <r_exp> where
- Handle partial evaluation of expressions involving
a + 3 * 4
a + 12 and no
message should be printed.
- Perform basic algebra on identifiers. For instance,
0 * a should evaluate to
file that demonstrate your
ability to handle good and bad input appropriately. Running
make check will create a file
result that will
output. We will combine the testcases from all groups and use them to
test your improved Tiny expression evaluators.
Finally, based on your experiences, answer the following
your milestone report:
The original Tiny source code is here: tiny.
- Which toolset you will use for the WIG project?
- What was frustrating about this milestone? Difficult? Time
consuming? Boring? Easy? Interesting? Fun? You can include
discussion of things such as using version control, group
coordination, and environment setup.
- What devious extension to the Tiny expressions should we
students for next year?
svn cp to create a branch
check that in, and then start your modifications. The milestone
report should be checked as group-X/reports/tiny.txt.
There is no need to email us on completion.
Unless you took a late day we will automatically take the version into
account that was checked in last before the point of the deadline.