snippetbashTip
flex — Lexical analyzer generator. Given the specification for a lexical analyzer, generates C code impleme
Viewed 0 times
thegivencommandgeneratorlexicalflexclianalyzer
linux
Problem
How to use the
flex command: Lexical analyzer generator. Given the specification for a lexical analyzer, generates C code implementing it. More information: <https://manned.org/flex>.Solution
flex — Lexical analyzer generator. Given the specification for a lexical analyzer, generates C code implementing it. More information: <https://manned.org/flex>.Generate an analyzer from a Lex file, storing it to the file
lex.yy.c:flex {{analyzer.l}}Write analyzer to
stdout:flex {{[-t|--stdout]}} {{analyzer.l}}Specify the output file:
flex {{analyzer.l}} {{[-o|--outfile]}} {{analyzer.c}}Generate a batch scanner instead of an interactive scanner:
flex {{[-B|--batch]}} {{analyzer.l}}Compile a C file generated by Lex:
cc {{path/to/lex.yy.c}} -o {{executable}}Code Snippets
Generate an analyzer from a Lex file, storing it to the file `lex.yy.c`
flex {{analyzer.l}}Write analyzer to `stdout`
flex {{[-t|--stdout]}} {{analyzer.l}}Specify the output file
flex {{analyzer.l}} {{[-o|--outfile]}} {{analyzer.c}}Generate a batch scanner instead of an interactive scanner
flex {{[-B|--batch]}} {{analyzer.l}}Compile a C file generated by Lex
cc {{path/to/lex.yy.c}} -o {{executable}}Context
tldr-pages: linux/flex
Revisions (0)
No revisions yet.