1plex(1) Pascal lexical analyzer generator plex(1)
2
3
4
6 plex - The Pascal Lex lexical analyzer generator.
7
8
9
11 lex [options] lex-file[.l] [output-file[.pas]]
12
13
14
16 -v Verbose: plex generates a readable description of the generated
17 lexical analyzer, written to lex-file with new extension .lst
18
19 -o Optimize: plex optimizes DFA tables to produce a minimal DFA.
20
21
23 plex is a program generator that is used to generate the Turbo Pascal
24 source code for a lexical analyzer subroutine from the specification of
25 an input language by a regular expression grammar.
26
27 plex parses the source grammar contained in lex-file (with default suf‐
28 fix .l) and writes the constructed lexical analyzer subroutine to the
29 specified output-file (with default suffix .pas); if no output file is
30 specified, output goes to lex-file with new suffix .pas. If any errors
31 are found during compilation, error messages are written to the list
32 file (lex-file with new suffix .lst).
33
34 The generated output file contains a lexical analyzer routine, yylex,
35 implemented as:
36
37 function yylex : Integer;
38
39 This routine has to be called by your main program to execute the lexi‐
40 cal analyzer. The return value of the yylex routine usually denotes the
41 number of a token recognized by the lexical analyzer (see the return
42 routine in the LexLib unit). At end-of-file the yylex routine normally
43 returns 0.
44
45 The code template for the yylex routine may be found in the yylex.cod
46 file. This file is needed by TP Lex when it constructs the output file.
47 It must be present either in the current directory or in the directory
48 from which TP Lex was executed (TP Lex searches these directories in
49 the indicated order). (NB: For the Linux/Free Pascal version, the code
50 template is searched in some directory defined at compile-time instead
51 of the execution path, usually /usr/lib/fpc/lexyacc.)
52
53 The TP Lex library (LexLib) unit is required by programs using Lex-gen‐
54 erated lexical analyzers; you will therefore have to put an appropriate
55 uses clause into your program or unit that contains the lexical ana‐
56 lyzer routine. The LexLib unit also provides various useful utility
57 routines; see the file lexlib.pas for further information.
58
59
60
62 For more information, see the documentation that comes with plex and
63 yacc.
64
65
67 Albert Graeff (<ag@muwiinfa.geschichte.uni-mainz.de>, <Dr.Graef@t-
68 online.de>)
69
70
72 ppc386(1) pyacc(1)
73
74
75
76Free Pascal 10 Jan 2000 plex(1)