Aktív témák

  • zeronero

    csendes tag

    Sziasztok flex-bisonc++ párossal kéne egy feladatot megoldani, de folyton hasonloó hibákat kapok::: Egyenlőre a hibákat, és a parserbase.h rakom ki. De ha kell akkor majd kirakom a flex és bisonc++ fileokat is...Fontos lenne, aki tud kérem tegye..

    g++ while while.cc parse.cc lex.yy.cc

    In file included from Parser.h:5,
    from while.l:6:
    Parserbase.h:27: error: expected identifier before â(â token
    Parserbase.h:27: error: expected `}' before â(â token
    Parserbase.h:27: error: expected primary-expression before â,â token
    Parserbase.h:27: error: ISO C++ forbids initialization of member âyy_startâ
    Parserbase.h:27: error: making âyy_startâ static
    Parserbase.h:27: error: ISO C++ forbids in-class initialization of non-const static member âyy_startâ
    Parserbase.h:61: error: expected unqualified-id before â}â token
    Parserbase.h:67: error: expected unqualified-id before âprivateâ
    Parserbase.h:72: error: expected unqualified-id before âprotectedâ
    Parserbase.h:94: error: expected unqualified-id before â)â token
    Parserbase.h:96: error: non-member function âvoid ABORT()â cannot have cv-qualifier
    Parserbase.h:97: error: non-member function âvoid ACCEPT()â cannot have cv-qualifier
    Parserbase.h:98: error: non-member function âvoid ERROR()â cannot have cv-qualifier
    Parserbase.h:100: error: non-member function âbool debug()â cannot have cv-qualifier
    Parserbase.h:107: error: non-member function âsize_t top__()â cannot have cv-qualifier
    Parserbase.h:109: error: expected unqualified-id before âpublicâ
    Parserbase.h:111: error: expected declaration before â}â token

    parserbase.h
    // Generated by Bisonc++ V2.4.2 on Sun Apr 11 19:06:42 2010 +0100

    #ifndef ParserBase_h_included
    #define ParserBase_h_included

    #include <vector>
    #include <iostream>

    // $insert preincludes
    #include <iostream>

    namespace // anonymous
    {
    struct PI__;
    }


    class ParserBase
    {
    public:
    // $insert tokens

    // Symbolic tokens:
    enum Tokens__
    {
    SKIPTHIS = 257,
    BEGIN,
    END,
    PROGRAM,
    VARIABLE,
    WHILE,
    DO,
    DONE,
    IF,
    THEN,
    ENDIF,
    ELSE,
    SEMICOL,
    LPAR,
    RPAR,
    TRUE,
    FALSE,
    WRITE,
    READ,
    ASSIGN,
    NUMBER,
    ENDLINE,
    INTEGER,
    BOOLEAN,
    NOT,
    OR,
    AND,
    EQUAL,
    LESS,
    MORE,
    PLUS,
    MINUS,
    MULT,
    DIV,
    MOD,
    };

    // $insert STYPE
    typedef int STYPE__;


    private:
    int d_stackIdx__;
    std::vector<size_t> d_stateStack__;
    std::vector<STYPE__> d_valueStack__;

    protected:
    enum Return__
    {
    PARSE_ACCEPT__ = 0, // values used as parse()'s return values
    PARSE_ABORT__ = 1
    };
    enum ErrorRecovery__
    {
    DEFAULT_RECOVERY_MODE__,
    UNEXPECTED_TOKEN__,
    };
    bool d_debug__;
    size_t d_nErrors__;
    size_t d_requiredTokens__;
    size_t d_acceptedTokens__;
    int d_token__;
    int d_nextToken__;
    size_t d_state__;
    STYPE__ *d_vsp__;
    STYPE__ d_val__;
    STYPE__ d_nextVal__;

    ParserBase();

    void ABORT() const;
    void ACCEPT() const;
    void ERROR() const;
    void clearin();
    bool debug() const;
    void pop__(size_t count = 1);
    void push__(size_t nextState);
    void popToken__();
    void pushToken__(int token);
    void reduce__(PI__ const &productionInfo);
    void errorVerbose__();
    size_t top__() const;

    public:
    void setDebug(bool mode);
    };

    inline bool ParserBase::debug() const
    {
    return d_debug__;
    }

    inline void ParserBase::setDebug(bool mode)
    {
    d_debug__ = mode;
    }

    inline void ParserBase::ABORT() const
    {
    throw PARSE_ABORT__;
    }

    inline void ParserBase::ACCEPT() const
    {
    throw PARSE_ACCEPT__;
    }

    inline void ParserBase::ERROR() const
    {
    throw UNEXPECTED_TOKEN__;
    }


    // As a convenience, when including ParserBase.h its symbols are available as
    // symbols in the class Parser, too.
    #define Parser ParserBase


    #endif

Aktív témák