$$$$ info flex
>>>> goto simple examples <<<<
$$$$ ls
ex1.l  ex2.l  ex3.l  ex4.l  ex4.y
$$$$ flex ex1.l
$$$$ ls -ltR | head -4
.:
total 68
-rw-r--r-- 1 brock users 44415 Sep 12 10:01 lex.yy.c
-rw-r--r-- 1 brock users   503 Sep 11 16:50 ex4.y
$$$$ more lex.yy.c 

#line 3 "lex.yy.c"

#define  YY_INT_ALIGNED short int

/* A lexical scanner generated by flex */

#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 6
$$$$ cc lex.yy.c -o doit1 -ll
$$$$ ls -ltR | head -6
.:
total 92
-rwxr-xr-x 1 brock users 23600 Sep 12 10:02 doit1
-rw-r--r-- 1 brock users 44415 Sep 12 10:01 lex.yy.c
-rw-r--r-- 1 brock users   503 Sep 11 16:50 ex4.y
-rw-r--r-- 1 brock users   355 Sep 11 16:44 ex4.l
$$$$ ./doit1
hello
are you there
stop
start
$$$$ more ex3.l 
#include <stdio.h>
%}

%%
[a-zA-Z][a-zA-Z0-9]*    printf("WORD ");
[a-zA-Z0-9\/.-]+        printf("FILENAME ");
\"                      printf("QUOTE ");
\{                      printf("OBRACE ");
\}                      printf("EBRACE ");
--More--(63%) 
$$$$ flex ex2.l 
$$$$ cc lex.yy.c -o doit2 -ll
$$$$ ./doit2
what is happeneding?
do it again
28804
$$$$ cat ex3.l
#include <stdio.h>
%}

%%
[a-zA-Z][a-zA-Z0-9]*    printf("WORD ");
[a-zA-Z0-9\/.-]+        printf("FILENAME ");
\"                      printf("QUOTE ");
\{                      printf("OBRACE ");
\}                      printf("EBRACE ");
;                       printf("SEMICOLON ");
\n                      printf("\n");
[ \t]+                  /* ignore whitespace */;
%%
$$$$ flex ex3.l ; cc lex.yy.c -o doit3 -ll
$$$$ ./doit3
hello
/dev/null
"really?"
{ in braced }
x = 5 ;
$$$$ cat ex3mod.l
$$$$ flex ex3mod.l
$$$$ cc lex.yy.c -o doit3mod -ll
$$$$ ./doit3mod 
This is CSCI 434
