An Acronym for fast lexical analyzer generator.

Flex is used to generate C programs that perform pattern matching on text. It produces a single lex.yy.c file which defines a single yylex() function, which can compiled and linked with libfl to produce an executable that analyzes its input for occurrences of regular expres­sions. Whenever it finds one, it executes the correspond­ing C code.

It is usually used in conjunction with Bison. The Flex code then passes the tokens it finds to the yacc(1) style parser generated by Bison.

As a completely spurious example this is what the rules file could look like


  1. include <string.h>




/* pattern action */

{MATCHBOB} {printf("bob has been found!);}


/*user supplied functions */

See also: flex(1) lex(1) bison(1) yacc(1)

The following authors of this page have not agreed to the WlugWikiLicense. As such copyright to all content on this page is retained by the original authors. The following authors of this page have agreed to the WlugWikiLicense.

PHP Warning

lib/plugin/WlugLicense.php:99: Warning: Invalid argument supplied for foreach()

lib/plugin/WlugLicense.php:111: Warning: in_array() [<a href=''></a>]: Wrong datatype for second argument

lib/plugin/WlugLicense.php:111: Notice: Undefined variable: ignore_authors