GSoC/GCI Archive
Google Code-in 2012 BRL-CAD

Create a flex+bison tutorial

completed by: javamonn

mentors: Sean

BRL-CAD has a long history working with lexer and parser grammars.  For the longest time, we used the popular Flex (Lex) and Bison (Yacc) tools for generating parsers but recently are migrating to a new system.  In order to demonstrate this new system, we need the simplest possible tutorial in the old system.

This task involves writing a VERY simple demonstration of a flex+bison parser.  The goal is to make a simple tutorial that creates a trivial calculator (supporting only +-*/ and perhaps '()' parentheses).

References:

  • examples are abundant around the web, search for them
  • http://www.cs.man.ac.uk/~pjj/cs5031/ho/node5.html
  • http://dinosaur.compilertools.net/bison/bison_5.html
  • http://iamsrijon.wordpress.com/2009/12/23/infix-calculator-in-yacc-amp-flex/
  • http://epaperpress.com/lexandyacc/

Provide your lex source, yacc source, and a VERY brief tutorial write-up.  Remember the emphasis is on simplicity (and brevity).

Do not plagiarize someone else's work from the web.  You can use other people's work (where they permit it) as a starting point, but you should cite their contribution to your work and the tutorial text should be your own words.