1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 10:42:07 +02:00
tldr/pages/common/flex.md
K.B.Dharun Krishna 1de9190d63
pages.*: standardize capitalization in note term (#12195)
Signed-off-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2024-02-05 12:34:49 +05:30

690 B

flex

Lexical analyzer generator. A rewrite of lex with extensions to the POSIX specification. Given the specification for a lexical analyzer, generates C code implementing it. Note: long options don't work on OpenBSD. More information: https://manned.org/flex.

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

lex {{analyzer.l}}

  • Write analyzer to stdout:

lex -{{-stdout|t}} {{analyzer.l}}

  • Specify the output file:

lex {{analyzer.l}} -o {{analyzer.c}}

  • Generate a [B]atch scanner instead of an interactive scanner:

lex -B {{analyzer.l}}

  • Compile a C file generated by Lex:

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