1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-21 22:02:09 +02:00
tldr/pages/common/lex.md

484 B

lex

Lexical analyzer generator. Given the specification for a lexical analyzer, generates C code implementing it. Note: on most major OSes, this command is an alias for flex. More information: https://manned.org/lex.

  • Generate an analyzer from a Lex file, storing it to the file lex.yy.c:

lex {{analyzer.l}}

  • Specify the output file:

lex -t {{analyzer.l}} > {{analyzer.c}}

  • Compile a C file generated by Lex:

c99 {{path/to/lex.yy.c}} -o {{executable}}