Skip to content

Instantly share code, notes, and snippets.

@tuxdna
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuxdna/9803087 to your computer and use it in GitHub Desktop.
Save tuxdna/9803087 to your computer and use it in GitHub Desktop.
Compiling JFlex example with BYACC/J

Compiling JFlex example with BYACC/J

Target system

$ uname -svprmio; java -version; javac -version
Linux 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
java version "1.7.0_51"
OpenJDK Runtime Environment (IcedTea 2.4.4) (7u51-2.4.4-0ubuntu0.12.04.2)
OpenJDK 64-Bit Server VM (build 24.45-b08, mixed mode)
javac 1.7.0_51

Install jflex and byacc-j on Ubuntu

$ sudo aptitude install jflex byacc-j

You can also download byacc-j from this site: http://byaccj.sourceforge.net/

Checkout JFlex code from GitHub

$ git clone https://github.com/moy/JFlex.git

Compile the example

$ cd JFlex/jflex/examples/byaccj
$ make

Run the example

$ java Parser
BYACC/Java with JFlex Calculator Demo
[Quit with CTRL-D]
Expression: 10 + 12 * 0.1
 = 11.2
Expression: 10 + 12 * 0.5 / 1.2
 = 15.0
Expression: 
Have a nice day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment