Bison/Flex C++

Philipp Kraus <philipp.kraus@flashpixx.de>
Tue, 20 Apr 2010 16:47:32 +0200

          From comp.compilers

Related articles
Bison/Flex C++ philipp.kraus@flashpixx.de (Philipp Kraus) (2010-04-20)
| List of all articles for this month |

From: Philipp Kraus <philipp.kraus@flashpixx.de>
Newsgroups: comp.compilers
Date: Tue, 20 Apr 2010 16:47:32 +0200
Organization: 1&1 Internet AG
Keywords: bison, C++, question
Posted-Date: 20 Apr 2010 19:09:43 EDT

Hello,


I do my first steps in bison and would like to create C++ code.
I would like to create a parser and scanner for my grammer, so I
created this (very small code):


%{
        #includes <iostream>
        void yyerror (const char *error);
        int yylex( void );
%}


%%
expr : ;
%%


int main( void )
{
        return yyparse();
}


void yyerror( const char *error )
{
        std::cout << error << std::endl;
}


int yylex( void )
{
        return -1;
}


Do anyone know a good tutorial for flex and/or bison to create
C++ (template) classes? I had done this only in the theory :-(


Thanks Phil



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.