📄 lex.1
字号:
.\" SCCSID: @(#)lex.1 8.2 9/27/90.TH lex 1.SH Namelex \- generate lexical analyzer.SH Syntax.B lex[\fB\-tvfn\fR] \fIfile...\fR .SH Description.NXR "lex program generator".NXR "lexical analysis program" "generating".NXA "yacc compiler" "lex program generator"The .PN lexcommandgenerates programs to be used in simple lexical analysis of text.The input.I files(standard input default) contain regular expressionsto be searched for, and actions written in C to be executed whenexpressions are found..PPA C source program, 'lex.yy.c', is generated. It is compiled using the following command line:.EXcc lex.yy.c \-ll.EEThis program copies unrecognized portions ofthe input to the output, and executes the associatedC action for each regular expression that is recognized..SH Options.NXR "lex program generator" "options".IP \fB\-f\fR 5Runs a faster compilation (does not pack resulting tables).This is limited to small programs..IP \fB\-n\fR Prints no summary information (default option)..IP \fB\-t\fR Writes to standard output instead of to file .PN lex.yy.c ..IP \fB\-v\fR Prints one-line summary of generated statistics..SH Examples.NXR "lexical analysis program" "example"In the following example, the command.EXlex lexcommands.EEdraws.PN lexinstructions from the file.IR lexcommands ,and places the output in lex.yy.c.The command.EX%%[A\-Z] putchar(yytext[0]+\'a\'\-\'A\');[ ]+$[ ]+ putchar(\' \');.EE.PPis an example of a.PN lexprogram that would be put into a.PN lexcommand file. This program converts upper case to lower,removes blanks at the end of lines,and replaces multiple blanks by single blanks..SH See Alsosed(1), yacc(1).br"LEX \- Lexical Analyzer Generator",\fISupplementary Documents, Volume 2: Programmer\fP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -