|
Windows
To install JFlex on Windows 95/98/NT/XP, follow these three steps:
- Unzip the file you downloaded into the directory you want JFlex in (using
something like
WinZip).
If you unzipped it to say
C:\, the following directory structure
should be generated:
C:\JFlex\
+--bin\ (start scripts)
+--doc\ (FAQ and manual)
+--examples\
+--binary\ (scanning binary files)
+--byaccj\ (calculator example for BYacc/J)
+--cup\ (calculator example for cup)
+--interpreter\ (interpreter example for cup)
+--java\ (Java lexer specification)
+--simple\ (example scanner)
+--simple-maven\ (example with maven)
+--standalone\ (a simple standalone scanner)
+--standalone-maven\ (above with maven)
+--lib\ (the precompiled classes)
+--src\
+--JFlex\ (source code of JFlex)
+--JFlex\gui (source code of JFlex UI classes)
+--java_cup\runtime\ (source code of cup runtime classes)
- Edit the file
bin\jflex.bat
(in the example it's C:\JFlex\bin\jflex.bat)
such that
- JAVA_HOME contains the directory where your Java JDK is installed
(for instance
C:\java) and
- JFLEX_HOME the directory that contains JFlex (in the example:
C:\JFlex)
- Include the
bin\ directory of JFlex in your path.
(the one that contains the start script, in the example: C:\JFlex\bin).
To install JFlex on a Unix system, follow these two steps:
- Decompress the archive into a directory of your choice
with GNU tar, for instance to /usr/share:
tar -C /usr/share -xvzf jflex-1.4.3.tar.gz
(The example is for site wide installation. You need to
be root for that. User installation works exactly the
same way--just choose a directory where you have write
permission)
- Make a symbolic link from somewhere in your binary
path to bin/jflex, for instance:
ln -s /usr/share/JFlex/bin/jflex /usr/bin/jflex
If the Java interpreter is not in your binary path, you
need to supply its location in the script bin/jflex.
You can verify the integrity of the downloaded file with
the MD5 checksum available on the JFlex download page.
If you put the checksum file in the same directory
as the archive, you run:
md5sum --check jflex-1.4.3.tar.gz.md5
It should tell you
jflex-1.4.3.tar.gz: OK
- become root
- issue
rpm -U jflex-1.4.3-0.rpm
You can verify the integrity of the downloaded rpm file with
rpm --checksig jflex-1.4.3-0.rpm
You run JFlex with:
jflex <options> <inputfiles>
It is also possible to skip the start script in bin\
and include the file lib\JFlex.jar
in your CLASSPATH environment variable instead.
Then you run JFlex with:
java JFlex.Main <options> <inputfiles>
The input files and options are in both cases optional. If you don't provide a file name on
the command line, JFlex will pop up a window to ask you for one.
JFlex knows about the following options:
-d <directory>
writes the generated file to the directory <directory>
--skel <file>
uses external skeleton <file>. This is mainly for JFlex
maintenance and special low level customisations. Use only when you
know what you are doing! JFlex comes with a skeleton file in the
src directory that reflects exactly the internal, pre-compiled
skeleton and can be used with the -skel option.
--nomin
skip the DFA minimisation step during scanner generation.
--jlex
tries even harder to comply to JLex interpretation of specs.
--dot
generate graphviz dot files for the NFA, DFA and minimised
DFA. This feature is still in alpha status, and not
fully implemented yet.
--dump
display transition tables of NFA, initial DFA, and minimised DFA
--verbose or -v
display generation progress messages (enabled by default)
--quiet or -q
display error messages only (no chatter about what JFlex is
currently doing)
--time
display time statistics about the code generation process
(not very accurate)
--version
print version number
--info
print system and JDK information (useful if you'd like
to report a problem)
--pack
use the %pack code generation method by default
--table
use the %table code generation method by default
--switch
use the %switch code generation method by default
--help or -h
print a help message explaining options and usage of JFlex.
|