Main design goals of JFlex
The main design goals of JFlex are:
- Full unicode support
- Compatible with JLex
- Faster generated scanners
- Faster scanner generation
- Convenient specification syntax
- Platform independence
List of JFlex features
See also release history
Compatible with JLex
JFlex file specification syntax is compatible with the syntax of JLex, itself inspired by lex
on Unix.
The specification file can contain comments in any part.
JFlex has all the features of JLex, and more.
JFLex is fast
The lexers generated by JFlex are based on deterministic finite automates (DFA). They are fast, without expensive backtracking.
JFLex itself is fast to generate the lexer.
Regexps, Macros and Predefined character classes
Regular expressions in JFlex are powerful, they support repetition, negation, union, intersection, set difference, symmetric difference, etc.
Macros are abbreviations for regular expressions, they can be used to make lexical specifications easier to read and understand. Cycles in macro definitions are detected and reported at generation time.
JFlex comes with useful predefined character classes, such as \R
for any new-line character, [:uppercase:]
for an upper-case word, or [:jletter:]
that corresponds to Character.isJavaIdentifierStart()
Unicode and Platform independent
JFlex can scan Unicode files, with support for Unicode 7.0 to Unicode 12.1, including Emoji properties.
The end-of-line operator “$
” is platform independent, and detects end-of-line on Windows or Unix automatically.
Easy integration with parsers
JFlex has builtin support for several parser generators:
It can also integrate with ANTLR.
Easy to use in your project
JFlex can be used
Works as expected
- Beginning of line operator “
^
” works as expected (not consuming newlines) - Comments, character literals and strings in actions are handled correctly
Easy debugging
JFlex has column and line counters.
JFlex has debugging support.
JFlex can generate a standalone-lexer, independent of any parser.