mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-06-05 08:26:02 +02:00

* lex: add examples and add other BSD * lex: fix OpenBSD man link * lex: remove unsupported option from OpenBSD * lex: apply suggestions from code review Co-authored-by: Juri Dispan <juri.dispan@posteo.net> Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com> * flex, lex: moving flex options to common/flex.md * lex: mention `lex` alias to `flex` * Update pages/linux/lex.md --------- Co-authored-by: Juri Dispan <juri.dispan@posteo.net> Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
26 lines
690 B
Markdown
26 lines
690 B
Markdown
# 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}}`
|