linux操作系统 lex命令手册

lex

Lexical analyser generator. Given the specification for a lexical analyser, generates C code implementing it.

  • Generate an analyser from a Lex file:

lex {{analyser.l}}

  • Specify the output file:

lex {{analyser.l}} --outfile {{analyser.c}}

  • Compile a C file generated by Lex:

cc {{path/to/lex.yy.c}} --output {{executable}}