Can anyone suggest something for me to read to learn and understand look ahead and fall back.
I am have trouble writing a partial C pre-processor and wish to create a few non-terminals to handle the many different #xxxx things that can occur in header files. So if I have a non-terminal to handle #if or #ifdef then another to handle #elif and a final to handle #else like so /* ISO/IEC 9899:201x (6.10) */ if_group : NUMBER_SIGN KEYWORD_IF constant_expression NEW_LINE group | NUMBER_SIGN KEYWORD_IF constant_expression NEW_LINE | NUMBER_SIGN KEYWORD_IFDEF IDENTIFIER NEW_LINE group | NUMBER_SIGN KEYWORD_IFDEF IDENTIFIER NEW_LINE | NUMBER_SIGN KEYWORD_IFNDEF IDENTIFIER NEW_LINE group | NUMBER_SIGN KEYWORD_IFNDEF IDENTIFIER NEW_LINE ; /* ISO/IEC 9899:201x (6.10) */ elif_groups : elif_group | elif_groups elif_group ; /* ISO/IEC 9899:201x (6.10) */ elif_group : NUMBER_SIGN KEYWORD_ELIF constant_expression NEW_LINE group | NUMBER_SIGN KEYWORD_ELIF constant_expression NEW_LINE ; /* ISO/IEC 9899:201x (6.10) */ else_group : NUMBER_SIGN KEYWORD_ELSE NEW_LINE group | NUMBER_SIGN KEYWORD_ELSE NEW_LINE ; How do I not fail when the�NUMBER_SIGN finds an ELSE rather than a IF. Regards Stephen ____________________________________________________________ South Africas premier free email service - www.webmail.co.za
_______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison