CS 370 Lab #4

Name: ____________________________________________________

In this lab, you will practice your CFG's, and learn about and experiment with the YACC parser generator. I am available for consultation in my office on either lab or homework related topics.

Due: next week, before start of lab

Complete the following exercises. Turn in a paper copy of your solutions; no electronic turnin for this lab.

1. Read the Bison manual.

2. What command-line option do you use to cause Bison to generate token definitions in a y.tab.h file?

3. What is the name of the data type YACC uses for elements on its value stack?

4. What does yyparse() return to indicate no syntax errors were found?

5. Write a YACC specification for the grammar given below. Test your solution by making sure it actually is accepted by the bison command.

S -> AA
A -> AAA | a | bA | Ab