mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-07-18 19:16:00 +02:00
74 lines
2.4 KiB
Groff
74 lines
2.4 KiB
Groff
.TH plex 1 "10 Jan 2000" "Free Pascal" "Pascal lexical analyzer generator"
|
|
.SH NAME
|
|
plex \- The Pascal Lex lexical analyzer generator.
|
|
|
|
|
|
.SH USAGE
|
|
|
|
.B lex [options] lex-file[.l] [output-file[.pas]]
|
|
|
|
|
|
.SH OPTIONS
|
|
|
|
.TP
|
|
.B \-v
|
|
.I Verbose:
|
|
Lex generates a readable description of the generated
|
|
lexical analyzer, written to lex-file with new extension
|
|
.I .lst
|
|
.TP
|
|
.B \-o
|
|
.I Optimize:
|
|
Lex optimizes DFA tables to produce a minimal DFA.
|
|
|
|
.SH DESCRIPTION
|
|
|
|
TP Lex is a program generator that is used to generate the Turbo Pascal source
|
|
code for a lexical analyzer subroutine from the specification of an input
|
|
language by a regular expression grammar.
|
|
|
|
TP Lex parses the source grammar contained in lex-file (with default suffix
|
|
.l) and writes the constructed lexical analyzer subroutine to the specified
|
|
output-file (with default suffix .pas); if no output file is specified, output
|
|
goes to lex-file with new suffix .pas. If any errors are found during
|
|
compilation, error messages are written to the list file (lex-file with new
|
|
suffix .lst).
|
|
|
|
The generated output file contains a lexical analyzer routine, yylex,
|
|
implemented as:
|
|
|
|
.RS
|
|
function yylex : Integer;
|
|
.RE
|
|
|
|
This routine has to be called by your main program to execute the lexical
|
|
analyzer. The return value of the yylex routine usually denotes the number
|
|
of a token recognized by the lexical analyzer (see the return routine in the
|
|
LexLib unit). At end-of-file the yylex routine normally returns 0.
|
|
|
|
The code template for the yylex routine may be found in the yylex.cod
|
|
file. This file is needed by TP Lex when it constructs the output file. It
|
|
must be present either in the current directory or in the directory from which
|
|
TP Lex was executed (TP Lex searches these directories in the indicated
|
|
order). (NB: For the Linux/Free Pascal version, the code template is searched
|
|
in some directory defined at compile-time instead of the execution path,
|
|
usually /usr/lib/fpc/lexyacc.)
|
|
|
|
The TP Lex library (LexLib) unit is required by programs using Lex-generated
|
|
lexical analyzers; you will therefore have to put an appropriate uses clause
|
|
into your program or unit that contains the lexical analyzer routine. The
|
|
LexLib unit also provides various useful utility routines; see the file
|
|
lexlib.pas for further information.
|
|
|
|
|
|
.SH MORE INFORMATION
|
|
|
|
For more information, see the documentation that comes with TP lex and yacc.
|
|
|
|
.SH AUTHOR
|
|
Albert Graeff (<ag@muwiinfa.geschichte.uni-mainz.de>, <Dr.Graef@t-online.de>)
|
|
|
|
.SH SEE ALSO
|
|
.BR ppc386 (1)
|
|
.BR pyacc (1)
|