Skip to content

A reentrant example parser with custom parameters with flex/bison

License

Notifications You must be signed in to change notification settings

ascii-boxes/flex-bison-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flex-bison-example

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.

Difference from meyerd/flex-bison-example

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 and out dirs

Resources

Helpful links that I used:

Languages

  • Yacc 47.7%
  • C 22.6%
  • Lex 20.0%
  • Makefile 9.7%