Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.

Similar presentations


Presentation on theme: "1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi."— Presentation transcript:

1 1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi

2 Outline 1. JFLex 2. Summary 2

3 JFLex Scanner Generating Tool 3

4 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 http://www.jflex.de/http://www.jflex.de/ 4

5 Installing JFLex Download latest JDK from http://java.sun.com and install ithttp://java.sun.com Download zip file of JFLex 1.6.0 from http://www.jflex.de/download.html http://www.jflex.de/download.html Unzip the jflex-1.6.0.zip file as: C:\jflex-1.6.0 Eidt C:\jflex-1.6.0\bin\jflex.bat file and set value of JFLEX_HOME as follows: set JFLEX_HOME=C:\jflex-1.6.0 Include C:\jflex-1.6.0\bin\ directory in PATH environment variable 5

6 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

7 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

8 Running JFLex 8

9 Generating Lexer.java 9

10 Assignment# 2 http://jbillu.net/cc/Assignments/ 10

11 11 Summary Any Questions?


Download ppt "1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi."

Similar presentations


Ads by Google