help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

%union errors


From: Benny Hardage
Subject: %union errors
Date: Fri, 5 Dec 2008 19:02:15 -0600

Hello,

I'm receiving the following errors when I compile:

In file included from compiler.l:17:
parser.y:27: error: ISO C++ forbids declaration of 'list' with no type
parser.y:27: error: invalid use of '::'
parser.y:27: error: expected ';' before '<' token
parser.y:28: error: ISO C++ forbids declaration of 'Variable' with no type
parser.y:28: error: expected ';' before '*' token
parser.y:29: error: ISO C++ forbids declaration of 'UnaryOperation' with no type
parser.y:29: error: expected ';' before '*' token
parser.y:30: error: ISO C++ forbids declaration of 'BinaryOperation'
with no type
parser.y:30: error: expected ';' before '*' token
parser.y:31: error: ISO C++ forbids declaration of 'Expression' with no type
parser.y:31: error: expected ';' before '*' token
parser.y:32: error: ISO C++ forbids declaration of 'DataLiteral' with no type
parser.y:32: error: expected ';' before '*' token

I've seen a fairly old thread that attempted to address this issue,
saying that my include files might not be in the right order, but the
top of my file looks like the following:

%error-verbose

%{

int yylex();

#include <iostream>
#include "expressions.hpp"
#include "statements.hpp"

extern bool outputTokens;
extern bool outputParser;

void yyerror( char* msg )
{
        std::cerr << msg << std::endl;
}

%}

%union
{
        int intVal;
        bool boolVal;
        char* strVal;
        std::list<const Variable::Qualifier*>* qList;
        Variable* var;
        UnaryOperation* uop;
        BinaryOperation* binop;
        Expression* expr;
        DataLiteral* datalit;
}

expressions.hpp contains the datatypes in question.

I was wondering if someone might let me know what I was doing wrong.

Thanks,
B.J.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]