The gml4gtk program is using flex to generate C source lexer code
with the mkpl script.
The flex software is now on github at https://github.com/westes/flex
The newest manual is here at https://westes.github.io/flex/manual/index.html#Top
or in this file at flex.html
For C++ there is also a flex compatible tool at https://github.com/Genivia/RE-flex
The generated source C code does not create issues using valgrind or
which means that the C code is of excellent quality.
It is possible to use own skeleton with flex with more fine tuning.
Using the flex lexer with memory wrappers and these options like
/* own yyalloc */
void *yyalloc (size_t n)
void yyfree (void *ptr)
void *yyrealloc (void *ptr, size_t n)
return (dp_realloc (ptr,n));
/* use own yyalloc */
/* no yywrap() at end-of-file */
/* do not push back chars in stream function() */
/* no input() function */
/* input does not come from a tty. */
/* no yywrap() at end of file */
/* 8-bits scanner */
/* use nameprefix for routines */
/* add debug output */
/* use clib to read data */
Flex does not generate graph data but maybe something is possible.
And flex can be used with own customized skeletons using the -S
option like this:
flex -Smyflex.skl input.l
To create myflex.skl, go to the source src directory of flex lexer
tool 2.6.4 with flex.skl file.
Then use this sed command to generate myflex.skl:
sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' flex.skl | m4 -P
-DFLEX_SUBMINOR_VERSION=4 | sed 's/m4postproc_/m4_/g' >
The myflex.skl can be edited with some care because it is a mix of
C, C++ and m4 language.
The ready-to-use skeleton for flex-2.6.4 lexer is here as text file
The ready-to-use skeleton for flex-2.5.37 lexer is here as text file