1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-23 15:42:09 +02:00
tldr/pages/linux/lex.md
Vitor Henrique c19a39c1d4
lex: add examples and add {Free,Net,Open}BSD pages (#11895)
* 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>
2024-01-07 14:44:19 +05:30

25 lines
589 B
Markdown

# lex
> Lexical analyzer generator.
> Given the specification for a lexical analyzer, generates C code implementing it.
> More information: <https://manned.org/lex.1>.
- Generate an analyzer from a Lex 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}} --outfile {{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}}`