------
Usage
------
Gerwin Klein <lsf37@users.sf.net>
Régis Décamps <decamps@users.sf.net>
------
November 2, 2007
------
About this project
This sample project parses a grammar with JFlex.
The project management is done with Maven.
The project contains a simple grammar for the "Toy programming language".
It is the example from the JLex web site with some small
modifications, to make it a bit more readable.
It does nothing really useful, because there is no parser for
the toy programming language. It's just a demonstration how a
small simple scanner looks like.
* JFlex
JFlex is a parser generator. Given a grammar, JFlex generate
Java (TM) code to parse documents that follow this grammar.
* Maven
Maven is a project management framework.
The project is described in as a POM (project object model,
stored into <<<pom.xml>>>).
This document isn't intended to be a tutorial on the use of Maven 2,
you should consult the {{{http://maven.apache.org/}Maven web site}}.
The integration of JFlex and Maven is done with
{{{http://jflex.sourceforge.net/maven-flex-plugin/}maven-flex-plugin}}.
Usage
* mvn generate-sources
The maven-jflex-plugin will read the grammar
<<<src/main/jflex/simple.jflex>>>
and generate a Java scanner <<<Yylex.java>>>
in <<<target/generated-sources/flex>>>
This is defined by the following section
+---------
<build>
<plugins>
<plugin>
<groupId>de.jflex.maven.plugin</groupId>
<artifactId>maven-jflex-plugin</artifactId>
<version>0.2</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
+------------
By default, the maven-jflex-plugin generates a scanner/parser for every file
in <<<src/main/jflex/>>>.
* mvn test
This goal test the generated scanner (if required, the lexer will be
generated and all Java classes will be compiled)
by running all tests in <<<src/test/java>>>.
There is only one test in <<<src/test/java/YylexTest.java>>>.
In this test,
the scanner is run with the input file <<<src/test/resources/test.txt>>>.
By default, the scanner outputs debugging information about each
returned token to <<<System.out>>> until the end of file is reached,
or an error occurs.
But in the test, the output is redirected into <<<target/output.actual>>>.
The test is successful if every line match
with <<<src/test/resources/output.good>>>,
which is the expected scanner debugging information.
References
* {{{http://jflex.sourceforge.net/maven-flex-plugin/}maven-flex-plugin}}
* {{{http://maven.apache.org/}Maven web site}}.
没有合适的资源?快使用搜索试试~ 我知道了~
jflex-1.4.2.rar_ jflex-1.4.3_JFl_JFlex_Jflex 1.4_jflex-1.4.3.zip
共165个文件
java:91个
flex:11个
readme:9个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 81 浏览量
2022-09-19
14:27:19
上传
评论
收藏 1.21MB RAR 举报
温馨提示
java语法解释器生成器,有源码和相关文档
资源推荐
资源详情
资源评论
收起资源包目录
jflex-1.4.2.rar_ jflex-1.4.3_JFl_JFlex_Jflex 1.4_jflex-1.4.3.zip (165个子文件)
usage.apt 3KB
example.as 387B
jflex.bat 559B
changelog 13KB
COPYRIGHT 12KB
COPYRIGHT 12KB
manual.css 961B
LexParse.cup 24KB
java12.cup 23KB
ycalc.cup 10KB
parser.cup 4KB
skeleton.default 8KB
jflex-mode.el 2KB
sample.expected 100B
LexScan.flex 22KB
java.flex 14KB
lcalc.flex 5KB
unicode.flex 4KB
simple.flex 3KB
simple.flex 3KB
scanner.flex 3KB
calc.flex 2KB
binary.flex 2KB
standalone.flex 2KB
standalone.flex 2KB
logo.gif 31KB
output.good 14KB
output.good 14KB
lexer-output.good 13KB
output.good 86B
manual.ps.gz 257KB
manual.html 128KB
jflex_anttask.html 5KB
sample.in 103B
sample.inp 103B
JFlex.jar 175KB
LexScan.java 124KB
LexParse.java 96KB
Emitter.java 47KB
lr_parser.java 44KB
NFA.java 30KB
DFA.java 28KB
Out.java 12KB
CharClasses.java 11KB
StraightStreamReader.java 11KB
Main.java 11KB
IntCharSet.java 10KB
RegExp.java 10KB
ErrorMessages.java 9KB
StateSet.java 8KB
Action.java 8KB
MainFrame.java 7KB
OptionsDialog.java 7KB
JFlexTask.java 7KB
Skeleton.java 7KB
RegExps.java 7KB
Macros.java 7KB
PackEmitter.java 6KB
SemCheck.java 6KB
AntTaskTests.java 5KB
virtual_parse_stack.java 5KB
GridPanel.java 5KB
Interval.java 5KB
Options.java 4KB
ScannerException.java 4KB
CountEmitter.java 4KB
ComplexSymbolFactory.java 4KB
StateSetEnumerator.java 4KB
Tprogram.java 4KB
CharClassesTest.java 4KB
StdOutWriter.java 4KB
Timer.java 3KB
Main.java 3KB
CharSet.java 3KB
EOFActions.java 3KB
HiLowEmitter.java 3KB
GeneratorThread.java 3KB
Symbol.java 3KB
RegExp1.java 3KB
LexicalStates.java 3KB
CharClassInterval.java 3KB
CharSetEnumerator.java 3KB
Tdekl.java 3KB
StatePairList.java 3KB
SymTab.java 3KB
PackEmitterTest.java 3KB
Texplist.java 3KB
Tfun.java 3KB
RegExpTests.java 3KB
Tdekllist.java 2KB
SkeletonTest.java 2KB
Tboolexp.java 2KB
Texpinfix.java 2KB
Tident.java 2KB
TestLexer.java 2KB
Tifthenelse.java 2KB
AllTests.java 2KB
Tparlist.java 2KB
sym.java 2KB
EmitterTest.java 2KB
共 165 条
- 1
- 2
资源评论
四散
- 粉丝: 49
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功