A reentrant example parser with custom parameters with flex/bison
Install prerequisites. On Debian-based Linuxes, like:
$ apt-get install -y build-essential flex bison
Build using the Makefile
$ make
then run like so:
$ out/calc
Exit the calculator with exit
command or Ctrl-D.
This fork of meyerd/flex-bison-example adds:
- reentrant parser
- pass custom parameters to parser and lexer
- get custom data back from parser and lexer
- print line number in error messages
- compile source files individually, then link (as you would do in a larger code base)
- separate sources and generated files into
src
andout
dirs
Helpful links that I used: