1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi
Outline 1. JFLex 2. Summary 2
JFLex Scanner Generating Tool 3
JFLex JFlex is a lexical analyser generator for Java written in Java It is also a rewrite of the very useful tool JLex which was developed by Elliot Berk at Princeton University The official website of JFLex is 4
Installing JFLex Download latest JDK from and install ithttp://java.sun.com Download zip file of JFLex from Unzip the jflex zip file as: C:\jflex Eidt C:\jflex-1.6.0\bin\jflex.bat file and set value of JFLEX_HOME as follows: set JFLEX_HOME=C:\jflex Include C:\jflex-1.6.0\bin\ directory in PATH environment variable 5
How to get it going Install Java/JDK Install JFLex Create a specification file e.g. test.flex Run JFLex from command prompt by simply typing jflex Browse test.flex and output directory path and press Generate button Compile the generated Lexer.java and run it 6
JFLex Specification File The JFlex specification file consists of three parts divided by a single line starting with %: UserCode % Options and declarations % Lexical rules 7
Running JFLex 8
Generating Lexer.java 9
Assignment#
11 Summary Any Questions?