[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2.8 YACC Language Grammar

The processing directives and comments are not part of the grammar. They are handled by the scanner/lexer. The following was extracted directly from the defParse.y source file:

 
definitions : identity def_list TK_END
            { $$ = (YYSTYPE)(rootDefCtx.pDefs = (tDefEntry*)$2); } ;

def_list    : definition           { $$ = $1; }
            | definition def_list  { $$ = addSibMacro( $1, $2 ); }
            | identity   def_list  { $$ = $2; }
            ;

identity    : TK_AUTOGEN TK_DEFINITIONS anyname ';'
                { $$ = identify( $3 ); }
            ;

definition  : value_name ';'
                { $$ = makeMacro( $1, (YYSTYPE)"", VALTYP_TEXT ); }

            | value_name '=' text_list ';'
                { $$ = makeMacroList( $1, $3, VALTYP_TEXT ); }

            | value_name '=' block_list ';'
                { $$ = makeMacroList( $1, $3, VALTYP_BLOCK ); }
            ;

text_list   : anystring                { $$ = startList( $1 ); }
            | anystring ',' text_list  { $$ = appendList( $1, $3 ); }
            ;

block_list  : def_block                { $$ = startList( $1 ); }
            | def_block ',' block_list { $$ = appendList( $1, $3 ); }
            ;

def_block   : '{' def_list '}'         { $$ = $2; } ;

anystring   : anyname       { $$ = $1; }
            | TK_STRING     { $$ = $1; }
            | TK_NUMBER     { $$ = $1; } ;

anyname     : TK_OTHER_NAME { $$ = $1; }
            | TK_VAR_NAME   { $$ = $1; } ;

value_name  : TK_VAR_NAME
                { $$ = findPlace( $1, (YYSTYPE)NULL ); }

            | TK_VAR_NAME '[' TK_NUMBER ']'
                { $$ = findPlace( $1, $3 ); }

            | TK_VAR_NAME '[' TK_VAR_NAME ']'
                { $$ = findPlace( $1, $3 ); }
            ;



This document was generated by Bruce Korb on January, 7 2002 using texi2html