GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - jflex-de/jflex: The fast scanner generator for Java™ with full Unicode support

BranchesTags
Open more actions menu

Latest commit

 

History

2,213 Commits
2,213 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.mvn/wrapper
.mvn/wrapper
 
 
LICENSES
LICENSES
 
 
benchmark
benchmark
 
 
cup-maven-plugin
cup-maven-plugin
 
 
docs
docs
 
 
jflex-maven-plugin
jflex-maven-plugin
 
 
jflex
jflex
 
 
scripts
scripts
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CODEOWNERS
CODEOWNERS
 
 
LICENSE.md
LICENSE.md
 
 
README.md
README.md
 
 
RELEASE.md
RELEASE.md
 
 
REUSE.toml
REUSE.toml
 
 
mvnw
mvnw
 
 
mvnw.cmd
mvnw.cmd
 
 
pom.xml
pom.xml
 
 

Repository files navigation

Build

JFlex

JFlex is a lexical analyzer generator (also known as scanner generator) for Java.

JFlex takes as input a specification with a set of regular expressions and corresponding actions. It generates Java source of a lexer that reads input, matches the input against the regular expressions in the spec file, and runs the corresponding action if a regular expression matched. Lexers usually are the first front-end step in compilers, matching keywords, comments, operators, etc, and generating an input token stream for parsers.

JFlex lexers are based on deterministic finite automata (DFAs). They are fast, without expensive backtracking.

Usage

For documentation and more information see the JFlex documentation and the wiki.

Usage with Maven

Maven central

You need Maven 3.5.2 or later, and JDK 8 or later.

  1. Place grammar files in src/main/flex/ directory.

  2. Extend the project POM build section with the maven-jflex-plugin

      <build>
        <plugins>
          <plugin>
            <groupId>de.jflex</groupId>
            <artifactId>jflex-maven-plugin</artifactId>
            <version>1.9.0</version>
            <executions>
              <execution>
                <goals>
                  <goal>generate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
  3. Voilà: Java code is produced in target/generated-sources/ during the generate-sources phase (which happens before the compile phase) and included in the compilation scope.

Usage with ant

You need ant, the binary JFlex jar and JDK 8 or later.

  1. Define ant task

    <taskdef classname="jflex.anttask.JFlexTask" name="jflex"
            classpath="path-to-jflex.jar"/>
  2. Use it

    <jflex file="src/grammar/parser.flex" destdir="build/generated/"/>
    <javac srcdir="build/generated/" destdir="build/classes/"/>

Usage in CLI

You need the binary jflex jar and JDK 8 or later.

You can also use JFlex directly from the command line:

jflex/bin/jflex src/grammar/parser.flex

Or:

java -jar jflex-full-1.9.0.jar -d output src/grammar/parser.flex

Other build tools

See Build tool plugins.

Examples

Have a look at the sample project: simple and other examples.

Contributing

Javadoc

JFlex is free software, contributions are welcome. See the Contributing page for instructions.

Source layout

The top level directory of the JFLex git repository contains:

  • benchmark JMH benchmarks of generated scanners
  • cup-maven-plugin a simple Maven plugin to generate a parser with CUP
  • docs the Markdown sources for the user manual
  • jflex JFlex, the scanner/lexer generator for Java
  • jflex-maven-plugin the JFlex Maven plugin, that helps to integrate JFlex in your project
  • LICENSES the license texts, see REUSE.toml
  • scripts scripts for building, testing and releasing
  • src/site the descriptor of the Maven site
  • tests the test modules, which are not deployed: framework (test support), generators (Unicode generators), regression (end-to-end regression tests) and unicode (tests against the Unicode Character Database), see tests/README.md

Build from source

Build with Maven

You need JDK 8 or later.

./mvnw install

This generates jflex/target/jflex-full-1.9.1-SNAPSHOT.jar that you can use, e.g.

java -jar jflex-full-1.9.1-SNAPSHOT.jar --info

About

The fast scanner generator for Java™ with full Unicode support

jflex.de

Topics

bazel-rulescupdfadfa-minimizationflexgrammarjavalexerlexer-generatorlexical-analyzermaven-pluginnfaparsingregexpscannerscanner-generatortokenizeryacc

Resources

Readme
License
Activity
Custom properties

Stars

637 stars

Watchers

21 watching

Forks

119 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.