Game Programming Language
Phase 1: Expression parser
Overview:
Extend the simple expression parser in class
(expr directory) to include:
doubles, multiplication, and division.
This is intended to be an easy program to introduce you to
the tools flex and bison. The majority of your time and effort
will be devoted to learning the syntax of flex and bison. I
encourage you to make sure you understand all the components of expr.l
and expr.y. If you understand these now, it will make the main
project much easier.
This project uses two components from the main project: class Error,
and gpl_assert. If you learn how to use these now, it will make
the main project easier.
Sample tests can be found in test_directory.
Requirements:
I am very picky when it comes to students following
directions. In software development careers, following directions
is crucial. Thus I expect students to follow my requirements
exactly. I will grade your program using another program, so
your program must work exactly as specified for you to get full
credit.
Use * for multiplication, and / for
division.
A double can have any of the following forms:
In order to get full credit, bison must not generate any conflicts when processing your expr.
Hints:
The only thing you have to do is
to modify expr.l and expr.y. If you find yourself needing to
change something else, you are looking in the wrong place.
If you get any "conflicts" messages reported by bison, you have not
handled the precedence of * and / correctly. Look for "%left" in
expr.y to see how to set the precedence of * and /.
The goal of this assignment is for you to understand the flex/bison syntax. Make sure you understant it now.
Take a little time to understand the Makefile. You will use a very similar Makefile for the entire semester.
Here is an
introduction to regular
expressions. Mastering Regular Expressions is a great reference for regular expressions. This book if available on-line in the library's Safari Bookshelf (this link may only work from a csuchico.edu domain).