Search code examples
c++stringcompiler-constructionbisonflex-lexer

How to use C++ strings in bison


For a school project, I'm trying to make a compiler to 6502 using bison/flex. Not, for text parsing strings are nice -- you'd almost say necessary. While the bison generated files don't mind #include<string> and I'm compiling using g++, whenever I declare a string I get a compile error.

Bison: http://codebin.org/view/18738431

Lex: http://codebin.org/view/ef12def2

Makefile: http://codebin.org/view/b8885243


Solution

  • (Answered in the comments. See Question with no answers, but issue solved in the comments (or extended in chat) )

    @rici wrote:

    Perhaps you meant to declare a std::string, as defined by the standard header <string>, as opposed to the undefined string class. If that guess isn't correct, you might want to clarify what compile error you got.