1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/flex.md

18 lines
416 B
Markdown
Raw Normal View History

2017-12-30 16:16:30 +00:00
# flex
2022-06-27 12:23:12 +02:00
> Lexical analyzer generator. Based on `lex`.
> Given the specification for a lexical analyzer, generates C code implementing it.
2021-04-17 17:15:37 +02:00
> More information: <https://manned.org/flex>.
2017-12-30 16:16:30 +00:00
2022-06-27 12:23:12 +02:00
- Generate an analyzer from a flex file:
2017-12-30 16:16:30 +00:00
2022-06-27 12:23:12 +02:00
`flex {{analyzer.l}}`
2017-12-30 16:16:30 +00:00
- Specify the output file:
2022-06-27 12:23:12 +02:00
`flex --outfile {{analyzer.c}} {{analyzer.l}}`
2017-12-30 16:16:30 +00:00
- Compile a C file generated by flex:
`cc {{path/to/lex.yy.c}} --output {{executable}}`