9/16 @ 11:59 PM |
Not accepted late |
Create a calculator program using FLex and BISON. Your program
should be named calc and should take 1 input file (you can and
should use the calc program from the previous lab as the
starting point).
Calc should print out the AST of the expression in dot format.
For example, assume there is an input file input.txt
that contains the text 1+2+3
. If you run
./calc input.txt | dot -Tpng -o dfa1.png
Then the output file dfa1.png
should look like:
Note that this dot file uses a slightly different format than that described in the video. In particular, it uses the "record" shape for the nodes. The dotfile is as follows:
digraph dfa{ node1 [shape=record label="+"] node2 [shape=record label="+"] node3 [shape=record label="1"] node4 [shape=record label="2"] node5 [shape=record label="3"] node1 -> node2 [label="arm1"] node2 -> node3 [label="arm1"] node2 -> node4 [label="arm2"] node1 -> node5 [label="arm2"] }
Create a tarball consisting of a single directory with all of your work in it,
such as code or written answers.
If you have any auxiliary files (READMEs, Makefiles, etc.), be sure
to include those as well.
Name your work directory l3
and name
the tarball l3.tgz
.
Upload your tarball to the L3 Canvas assignment.
Labs will be graded under one of following criteria:
- Effort: You will automatically be given full credit for the labwork if the GTA determines that your participation in the lab was meaningful - i.e. you attended the lab session and used the time to make a good-faith attempt to complete the work. It is the sole discretion of the GTA to determine if you put in sufficient effort. Even if you expect an effort-based grade, you should turn in your (possibly incomplete) work.
- Correctness: If you do not participant meaningfully in lab (i.e. you do not attend the lab session), your grade will be assessed based on the correctness of your lab submission.
The two-criteria grading scheme above is designed to avoid wasting your time. You should not feel obligated to attend the lab, and in fact should only do so if you want help from the GTA on the labwork assignment or whatever project is currently in progress. Here's a handy flowchart for how I suggest you approach lab: