|
|
1.1 ! root 1: .\" @(#)lex.1 6.2 (Berkeley) 4/14/86 ! 2: .\" ! 3: .TH LEX 1 "April 14, 1986" ! 4: .AT 3 ! 5: .SH NAME ! 6: lex \- generator of lexical analysis programs ! 7: .SH SYNOPSIS ! 8: .B lex ! 9: [ ! 10: .B \-tvfn ! 11: ] [ file ] ... ! 12: .SH DESCRIPTION ! 13: .I Lex ! 14: generates programs to be used in simple lexical analyis of text. ! 15: The input ! 16: .I files ! 17: (standard input default) contain regular expressions ! 18: to be searched for, and actions written in C to be executed when ! 19: expressions are found. ! 20: .PP ! 21: A C source program, 'lex.yy.c' is generated, to be compiled thus: ! 22: .IP ! 23: cc lex.yy.c \-ll ! 24: .LP ! 25: This program, when run, copies unrecognized portions of ! 26: the input to the output, and executes the associated ! 27: C action for each regular expression that is recognized. ! 28: .PP ! 29: The options have the following meanings. ! 30: .TP ! 31: .B \-t ! 32: Place the result on the standard output instead of in file "lex.yy.c". ! 33: .TP ! 34: .B \-v ! 35: Print a one-line summary of statistics of the generated analyzer. ! 36: .TP ! 37: .B \-n ! 38: Opposite of ! 39: .BR \-v ; ! 40: .B \-n ! 41: is default. ! 42: .TP ! 43: .B \-f ! 44: "Faster" compilation: don't bother to pack ! 45: the resulting tables; limited to small programs. ! 46: .SH EXAMPLE ! 47: .IP ! 48: lex lexcommands ! 49: .PP ! 50: would draw ! 51: .I lex ! 52: instructions from the file ! 53: .I lexcommands, ! 54: and place the output in ! 55: .I lex.yy.c ! 56: .IP "" ! 57: .nf ! 58: .ta \w'[A\-Z] 'u ! 59: %% ! 60: [A\-Z] putchar(yytext[0]+\'a\'\-\'A\'); ! 61: [ ]+$ ; ! 62: [ ]+ putchar(\' \'); ! 63: .fi ! 64: .PP ! 65: is an example of a ! 66: .I lex ! 67: program that would be put into a ! 68: .I lex ! 69: command file. This program converts upper case to lower, ! 70: removes blanks at the end of lines, ! 71: and replaces multiple blanks by single blanks. ! 72: .SH "SEE ALSO" ! 73: yacc(1), sed(1) ! 74: .br ! 75: M. E. Lesk and E. Schmidt, ! 76: .I LEX \- Lexical Analyzer Generator
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.