lexi — Lexical analyser tool



[ -t t-prefix ] [ -p p-prefix ] [ -i i-prefix ] [ -l lang ]
input-file… [ output-file… ]


{ -h | -v }


lexi translates a description of a lexical analyser, input-file, into code implementing that analyser. This is output into the output-file argument, if present, or to standard output otherwise.

Both input-file and output-file may be given as - for standard input and standard output respectivley. These are language-specific (see the -l option), and may represent multiple files.

Lexer specifications for lexi are conventionally named with the extension .lxi, and actions .lct.


-t t-prefix

Causes lexi to use t-prefix as a prefix for its generated lexical tokens. The default is lex_.

-p p-prefix

Causes lexi to use p-prefix as a prefix for its generated internal symbols. The default is lexi_.

-i i-prefix

Causes lexi to use i-prefix as a prefix for its generated interface. The default is lexi_.

-l lang

The -l specifies the output language for the generated lexer. The input files and output files are specific to each language. The language is currently one of:

LanguageInput filesOutput filesDescription
C90 (default).lxi, .lct.c, .hISO C90
C99.lxi, .lct.c, .hISO C99
dot.lxi.dotGraphviz .dot format
test.lxiFor testing lexers

The language is case-insensitive.


Causes lexi to print its version number.


Causes lexi to print command-line usage help.

For further details of the options available and a reference to the format for files see the Lexi Users' Guide.

See Also

sid, Lexi Users' Guide.


lexi currently silently permits several semantically nonsensical but syntactically valid constructs which result in undefined behaviour. These are described in Lexi Users' Guide. It is expected that in future versions of lexi these will produce errors during compilation.