tldr/pages/common/lex.md

17 lines
348 B
Markdown
Raw Normal View History

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