mirror of
https://github.com/ivuorinen/cheatsheet-tldr.git
synced 2026-01-30 20:41:42 +00:00
31 lines
681 B
Plaintext
31 lines
681 B
Plaintext
---
|
|
syntax: markdown
|
|
tags: [tldr, linux]
|
|
source: https://github.com/tldr-pages/tldr.git
|
|
---
|
|
# 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}}`
|