Commit | Line | Data |
---|---|---|
c1030a02 TL |
1 | .TH LEX 1 |
2 | .SH NAME | |
3 | lex \- generator of lexical analysis programs | |
4 | .SH SYNOPSIS | |
5 | .B lex | |
6 | [ | |
7 | .B \-tvfn | |
8 | ] [ file ] ... | |
9 | .SH DESCRIPTION | |
10 | .I Lex | |
11 | generates programs to be used in simple lexical analyis of text. | |
12 | The input | |
13 | .I files | |
14 | (standard input default) | |
15 | contain regular expressions | |
16 | to be searched for, and actions written in C to be executed when | |
17 | expressions are found. | |
18 | .PP | |
19 | A C source program, `lex.yy.c' is generated, to be compiled thus: | |
20 | .IP | |
21 | cc lex.yy.c \-ll | |
22 | .LP | |
23 | This program, when run, copies unrecognized portions of | |
24 | the input to the output, | |
25 | and executes the associated | |
26 | C action for each regular expression that is recognized. | |
27 | .PP | |
28 | The following | |
29 | .I lex | |
30 | program converts upper case to lower, | |
31 | removes blanks at the end of lines, | |
32 | and replaces multiple blanks by single blanks. | |
33 | .IP "" | |
34 | .nf | |
35 | .ta \w'[A\-Z] 'u | |
36 | %% | |
37 | [A\-Z] putchar(yytext[0]+\'a\'\-\'A\'); | |
38 | [ ]+$ | |
39 | [ ]+ putchar(\' \'); | |
40 | .fi | |
41 | .PP | |
42 | The options have the following meanings. | |
43 | .TP | |
44 | .B \-t | |
45 | Place the result on the standard output instead of in file | |
46 | `lex.yy.c'. | |
47 | .TP | |
48 | .B \-v | |
49 | Print a one-line summary of statistics of the generated analyzer. | |
50 | .TP | |
51 | .B \-n | |
52 | Opposite of | |
53 | .BR \-v ; | |
54 | .B \-n | |
55 | is default. | |
56 | .TP | |
57 | .B \-f | |
58 | `Faster' compilation: don't bother to pack | |
59 | the resulting tables; limited to small programs. | |
60 | .SH "SEE ALSO" | |
61 | yacc(1) | |
62 | .br | |
63 | M. E. Lesk and E. Schmidt, | |
64 | .I LEX \- Lexical Analyzer Generator |