MAN page from OpenSuSE fpc-3.0.4-lp152.5.59.x86_64.rpm
Section: Pascal lexical analyzer generator (1)
Updated: 10 Jan 2000Index
plex - The Pascal Lex lexical analyzer generator.
lex [options] lex-file[.l] [output-file[.pas]]
- Verbose:plexgenerates a readable description of the generatedlexical analyzer, written to lex-file with new extension .lst
- Optimize:plexoptimizes DFA tables to produce a minimal DFA.
plexis a program generator that is used to generate the Turbo Pascal sourcecode for a lexical analyzer subroutine from the specification of an inputlanguage by a regular expression grammar.
plexparses the source grammar contained in lex-file (with default suffix .l)and writes the constructed lexical analyzer subroutine to the specifiedoutput-file (with default suffix .pas); if no output file is specified, outputgoes to lex-file with new suffix .pas. If any errors are found duringcompilation, error messages are written to the list file (lex-file with newsuffix .lst).
The generated output file contains a lexical analyzer routine, yylex,implemented as:
function yylex : Integer;
This routine has to be called by your main program to execute the lexicalanalyzer. The return value of the yylex routine usually denotes the numberof a token recognized by the lexical analyzer (see the return routine in theLexLib unit). At end-of-file the yylex routine normally returns 0.
The code template for the yylex routine may be found in the yylex.codfile. This file is needed by TP Lex when it constructs the output file. Itmust be present either in the current directory or in the directory from whichTP Lex was executed (TP Lex searches these directories in the indicatedorder). (NB: For the Linux/Free Pascal version, the code template is searchedin 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-generatedlexical analyzers; you will therefore have to put an appropriate uses clauseinto your program or unit that contains the lexical analyzer routine. TheLexLib unit also provides various useful utility routines; see the filelexlib.pas for further information.
For more information, see the documentation that comes with plex and yacc.
Albert Graeff (<firstname.lastname@example.org
- MORE INFORMATION
- SEE ALSO
This document was created byman2html,using the manual pages.