------
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.3.zip_Grammar_jflex 1.4.3_jflex-1.4.3.zip
共328个文件
java:182个
flex:22个
readme:18个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 23 浏览量
2022-09-23
11:26:56
上传
评论
收藏 2.57MB ZIP 举报
温馨提示
JFlex is a suite software thats possible your write own a grammar language.
资源推荐
资源详情
资源评论
收起资源包目录
jflex-1.4.3.zip_Grammar_jflex 1.4.3_jflex-1.4.3.zip (328个子文件)
usage.apt 3KB
usage.apt 3KB
example.as 387B
example.as 387B
jflex.bat 559B
jflex.bat 559B
changelog 13KB
changelog 13KB
COPYRIGHT 12KB
COPYRIGHT 12KB
COPYRIGHT 12KB
COPYRIGHT 12KB
manual.css 961B
manual.css 961B
LexParse.cup 24KB
LexParse.cup 24KB
java12.cup 23KB
java12.cup 23KB
ycalc.cup 10KB
ycalc.cup 10KB
parser.cup 4KB
parser.cup 4KB
skeleton.default 8KB
skeleton.default 8KB
jflex-mode.el 2KB
jflex-mode.el 2KB
sample.expected 100B
sample.expected 100B
LexScan.flex 22KB
LexScan.flex 22KB
java.flex 14KB
java.flex 14KB
lcalc.flex 5KB
lcalc.flex 5KB
unicode.flex 4KB
unicode.flex 4KB
simple.flex 3KB
simple.flex 3KB
simple.flex 3KB
simple.flex 3KB
scanner.flex 3KB
scanner.flex 3KB
calc.flex 2KB
calc.flex 2KB
binary.flex 2KB
binary.flex 2KB
standalone.flex 2KB
standalone.flex 2KB
standalone.flex 2KB
standalone.flex 2KB
output.good 14KB
output.good 14KB
output.good 14KB
output.good 14KB
lexer-output.good 14KB
lexer-output.good 14KB
output.good 86B
output.good 86B
manual.ps.gz 259KB
manual.ps.gz 259KB
manual.html 129KB
manual.html 129KB
jflex_anttask.html 5KB
jflex_anttask.html 5KB
sample.in 103B
sample.in 103B
sample.inp 103B
sample.inp 103B
JFlex.jar 175KB
JFlex.jar 175KB
LexScan.java 124KB
LexScan.java 124KB
LexParse.java 96KB
LexParse.java 96KB
Emitter.java 47KB
Emitter.java 47KB
lr_parser.java 44KB
lr_parser.java 44KB
NFA.java 30KB
NFA.java 30KB
DFA.java 28KB
DFA.java 28KB
Out.java 12KB
Out.java 12KB
CharClasses.java 11KB
CharClasses.java 11KB
StraightStreamReader.java 11KB
StraightStreamReader.java 11KB
Main.java 11KB
Main.java 11KB
IntCharSet.java 10KB
IntCharSet.java 10KB
RegExp.java 10KB
RegExp.java 10KB
ErrorMessages.java 9KB
ErrorMessages.java 9KB
StateSet.java 8KB
StateSet.java 8KB
Action.java 8KB
Action.java 8KB
共 328 条
- 1
- 2
- 3
- 4
资源评论
周楷雯
- 粉丝: 78
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功