Yacc Page

For Phase 2: Parser:
yacc file: y     Whole makefile     Project makefile     main.cpp


C code examples:
Simple C code to show I/O:   C code example     output


Information:
Unix refresher
How Yacc works: yacc Notes
About makefiles: makefile Notes
Simple Makefile example: main comes from library     with your own main
Makefile example #1:   makefile example1
Makefile example #2:   makefile example2
Makefile example #3:   makefile example3


Yacc examples:
Notes about the examples
Entering the -v option give you state information, e.g., yacc -v y3
The output is in a file called y.output


Simple grammar (one valid string, "ioe"):   y1 example     y1 state information
Desk calculator (infix exprs, e.g, 2+3*4, and assignments, e.g., a=3):   y2 example     y2 state information
The Expr/Term/Factor grammar:  y3 example     y3 state information


Yacc parse tree for y3
Parse tree showing internals

Sample data:
If a.out is your executable, you can use redirection of standard input:   a.out < data1
This gets input from the file   data1   instead of standard input.
      Sample infix expressions: sample data1     sample data2

Stuff for your practice lab:
      Simple makefile example (one used with your own main): simple makefile
      Copy of y3 to use for lab practice:   hw file
      Sample main for use with yacc:   main.cpp
      Sample data from the lab:   sampledata file
      Data to run your lab with:   hwdata file