1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
*************************************************************
* JLex README Version 1.2 *
*************************************************************
Written by Elliot Berk [edited by A. Appel].
Contact appel@princeton.edu
with any problems relating to JLex.
The following steps describe the compilation and usage
of JLex.
(1) Choose some directory that is on your CLASSPATH, where
you install Java utilities such as JLex. I will refer
to this directory as "J", for example.
(2) Make a directory "J/JLex" and put the sourcefile Main.java
in J/JLex.
(3) Compile Main.java as you would any Java source file:
javac Main.java
This should produce a number of Java class files, including Main.class.
(4) To run JLex with a JLex specification file,
the usage is:
java JLex.Main <filename>
where <filename> is the name of the JLex
specification file. JLex will produce diagnostic
output to inform you of its progress and, upon
completion, will produce a Java source file that
contains the lexical analyzer. The name of the
lexical analyzer file will be the name of the
JLex specification file, with the string ".java"
added to the end. (So if the JLex specification
file is called foo.lex, the lexical analyzer source file
that JLex produces will be called foo.lex.java.)
(5) The resulting lexical analyzer source file
should be compiled with the Java compiler:
javac <filename>
where <filename> is the name of the lexical analyzer
source file. This produces a lexical analyzer class file,
which can then be used in your applications.
If the default settings have not been changed,
the lexical analyzer class will be called Yylex
and the classs files will named Yylex.class and Yytoken.class.
|