> Le 6 mai 2019 à 02:37, Joao Pedro Abreu De Souza <jp_ab...@id.uff.br> a écrit > : > > Hi folks. My friend Nicholas and I are trying to make a compiler for a > simpler language(just expressions by now) with flex and bison using C++.
Hi guys, You departed from the original example by using Flex's C++ output. It changes many things. I think that your problem is that you specified, in driver.hh: > // Give Flex the prototype of yylex we want ... > #define YY_DECL \ > yy::parser::symbol_type yylex(driver &drv) > // ... and declare it for the parser's sake. > YY_DECL; which is a bad because you are asking Flex to define the yylex *function* instead of the yyFlexLexer::yylex *member function*. As a result, none of the yyFlexLexer member variables will be found in yylex. Fix your definition of YY_DECL into something like > #define YY_DECL \ > yy::parser::symbol_type yyFlexLexer yylex(driver &drv) If you really want to use C++ output with Flex, you might find some inspiration here: https://gitlab.lrde.epita.fr/vcsn/vcsn/tree/master/lib/vcsn/dot Cheers. _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison