mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-26 11:33:59 +00:00
24 lines
577 B
Plaintext
24 lines
577 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, common]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# 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}}`
|