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