20101102 - Change the grammar to E -> E + T | E T ->...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
============================ CS 441 Fall 2010 -- JWJ Pre-class notes - do not distribute Tuesday, November 2, 2010 ============================ Topics First experience with Bison to create a simple calculator. Tasks Most of our class will be in the Multilab. - create a directory 20101102 - copy sources from http://www.epaperpress.com/lexandyacc/index.html to 20101102 - inspect the contents of the directory. Unzip if necessary - read the sources: calc1.l, calc2.y - inspect 'build' and make calc1.exe Note: the last step may need some adjustements, changing the code, etc. - add to calc2.y provision for additional operations by extending the grammar - the compilation produces errors. It is because of the grammar ambiguity.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Change the grammar to E -> E + T | E T -> T * F | F F -> (E) | integer- make executables for the above version; do you need to change calc1.l?- make calc3.exe Sources On-line resource: http://www.lugbe.ch/action/reports/lex_yacc.pdf (Tom Niemann tutorial on Lex and Yacc) http://www.epaperpress.com/lexandyacc/index.html Programming Assignment PA2a Play with the code from the above Web pages. Write three programs in the language described in the above tutorial. Show the syntax-trees and the code for your sample programs. One of the programs should compute the number of combinations C(n,k) using an iterative algorithm....
View Full Document

This document was uploaded on 12/14/2010.

Ask a homework question - tutors are online