词法分析器JFLEX

1、homepage and download

home page:http://jflex.de/docu.html

download:http://jflex.de/download.html

使用手册:http://jflex.de/manual.html

2、解压和配置环境变量

解压之后,编辑文件bin\jflex.bat,在其中设置java_home和jflex_home环境变量,JAVA_HOME默认为C:\JAVA,JFLEX_HOME默认为C:\JFLEX。

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)

3、生成词法解析文件

运行命令:jflex lexer.flex,则产生JFlexLexer.java的词法解析文件

  
  
  
  
  1. D:\jflex1.4.3\example>jflex lexer.flex 
  2. Reading "lexer.flex" 
  3. Constructing NFA : 955 states in NFA 
  4. Converting NFA to DFA : 
  5. ............................................................................ 
  6. ............................................................................ 
  7. ............................................................................ 
  8. ............................................................. 
  9. 447 states before minimization, 350 states in minimized DFA 
  10. Writing code to "JFlexLexer.java" 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(职场,休闲,词法分析器,JFLEX)