tldr/pages/common/lex.md

17 lines
348 B
Markdown
Raw Normal View History

2017-12-11 13:57:43 +00:00
# lex
> Lexical analyser generator.
2017-12-28 02:16:22 +00:00
> Given the specification for a lexical analyser, generates C code implementing it.
2017-12-11 13:57:43 +00:00
2017-12-28 02:16:22 +00:00
- Generate an analyser from a Lex file:
2017-12-11 13:57:43 +00:00
2017-12-11 21:28:07 +00:00
`lex {{analyser.l}}`
2017-12-11 13:57:43 +00:00
2017-12-11 21:30:23 +00:00
- Specify the output file:
2017-12-11 21:36:10 +00:00
`lex {{analyser.l}} --outfile {{analyser.c}}`
2017-12-11 21:30:23 +00:00
2017-12-28 02:16:22 +00:00
- Compile a C file generated by Lex:
2017-12-11 13:57:43 +00:00
2017-12-11 21:28:07 +00:00
`cc {{path/to/lex.yy.c}} --output {{executable}}`