一、homepage and downloadhtml
home page:http://jflex.de/docu.htmljava
download:http://jflex.de/download.htmlsql
使用手册:http://jflex.de/manual.htmlide
二、解压和配置环境变量flex
解压以后,编辑文件bin\jflex.bat
,在其中设置java_home和jflex_home环境变量,JAVA_HOME默认为C:\JAVA,JFLEX_HOME默认为C:\JFLEX。spa
JAVA_HOME contains the directory where your Java JDK is installed (for instance C:\java
) andcode
JFLEX_HOME the directory that contains JFlex (in the example: C:\JFlex
)orm
三、生成词法解析文件htm
运行命令:jflex lexer.flex,则产生JFlexLexer.java的词法解析文件get
- D:\jflex1.4.3\example>jflex lexer.flex
- Reading "lexer.flex"
- Constructing NFA : 955 states in NFA
- Converting NFA to DFA :
- ............................................................................
- ............................................................................
- ............................................................................
- .............................................................
- 447 states before minimization, 350 states in minimized DFA
- Writing code to "JFlexLexer.java"