Flex is a fast lexical analyzer used to generate the scanner, or tokenizer, which recognizes lexical patterns in text. It does this by reading the input description file (scanner.l) which is in the form of pairs of regular expressions and C code, called rules. Flex generates the C source file (scanner.yy.c) which defines the function ddsYYlex() which does all the work and ddsLexStr() which is the main entry routine used by other DDS funtions.

Bison is a general-purpose parser generator used to generate the parser C source files (parser.tab.h and parser.tab.c) which defines the function ddsYYparse used for parsing the DDS grammar syntax.

Standard lex and yacc do not support recursive compilation. Gnu Flex and Bison are used because the compiler is recursive, i.e. the parser calls the scanner which may return to the parser OR the scanner may *call* the parser (recursively).

    ddsCompileFmt   -->--+                                              
    (DDS_LEX_TRANSLATE)  |                                              
                         |                                              
    ddsMapStruct    -->--+                                              
    (DDS_LEX_MAP)        |                                              
                         |                                              
             +-------->--+--->  parser.y  <--->  scanner.l -----+             
             |                  ddsYYparse       ddsYYlex       |       
             |                                                  |       
             +-----  defn_value("dict","defn")  <---------------+       
             |         (DDS_LEX_DEFN)                           |       
             |                                                  |       
             +-----  ident("funky-name")  <---------------------+       
             |         (DDS_LEX_IDENT)                          |       
             |                                                  |       
             +-----  undefined ? ddsYYdepend  <-----------------+       
                       (DDS_LEX_TRANSLATE)   

    

The compiler is uses for two purposes. The "ddsCompileFmt" routine uses it to compile the format (fmt:*=... and fmt:*:*=...) definitions. The "ddsMapCompileSU2" and "ddsLinkiObjectSU" routines use it to compile the mapping (map:*:*.xxx=...) definitions.