Make sure you have a Linux environment for this project. You can use 'bolt', your own Linux machine, or Windows Subsystem for Linux(WSL). I highly recommend you directly use 'bolt' since it contains all the necessary tools preinstalled.
ssh <your-net-id>@bolt.cs.ucr.eduMake sure you have the following tools installed and check the version:
- flex -V (>=2.5)
- bison -V (>=3.0)
- git --version (>=1.8)
- make -v (>=3.8)
- gcc -v (>=4.8)
- g++ -v (>=4.8 optional if you wish to use C++)
Use 'git' to clone the project template:
git clone <your-repo-link> lab2Move your code in Lab1 into this new repository. Please do not directly overwrite the calc.lex file. Change the rules based on the knowledge you learned in Lab 2.
Read the documentation of Lab2 and your tasks in home page for lab2.
Modify both calc.lex and calc.y to create the parser of the calculator. Run the following command to generate a header that contains all the token definitions and a piece of C source code of the parser.
bison -v -g -d -o parser.c calc.y # it generates parser.h, parser.c, parser.output and parser.dot-doption will let bison generate the header fileparser.h, contains token and function definitions-voption will generateparser.outputwhich is a debugging file that shows the inner states and rules-goption will generate a GraphViz dot fileparser.dotwhich represents the pushdown automaton generated
After you finish all 4 tasks, you are done with the second part of this lab. You don't need to submit the code. Similarly, uploading to Github can keep your progress:
git add . # add all files under current folder to staged changes
git commit -m "lab2 - parser" # create a new commit
git push # upload to Github, it may requires your username and password of Github