Commit 0cd3f111 authored by zygzagZ's avatar zygzagZ

Nowa wersja gramatyki

parent 513b2d53
t.cpp
t.e
*.o
*.l
*.y
......
......@@ -745,164 +745,16 @@ Ass *Ass::clone() const
/******************** TableAss ********************/
TableAss::TableAss(PIdent *p1, Expr *p2, Expr *p3)
{
pident_ = p1;
expr_1 = p2;
expr_2 = p3;
}
TableAss::TableAss(const TableAss & other)
{
pident_ = other.pident_->clone();
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
}
TableAss &TableAss::operator=(const TableAss & other)
{
TableAss tmp(other);
swap(tmp);
return *this;
}
void TableAss::swap(TableAss & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
}
TableAss::~TableAss()
{
delete(pident_);
delete(expr_1);
delete(expr_2);
}
void TableAss::accept(Visitor *v)
{
v->visitTableAss(this);
}
TableAss *TableAss::clone() const
{
return new TableAss(*this);
}
/******************** TableIncr ********************/
TableIncr::TableIncr(PIdent *p1, Expr *p2)
{
pident_ = p1;
expr_ = p2;
}
TableIncr::TableIncr(const TableIncr & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
TableIncr &TableIncr::operator=(const TableIncr & other)
{
TableIncr tmp(other);
swap(tmp);
return *this;
}
void TableIncr::swap(TableIncr & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
TableIncr::~TableIncr()
{
delete(pident_);
delete(expr_);
}
void TableIncr::accept(Visitor *v)
{
v->visitTableIncr(this);
}
TableIncr *TableIncr::clone() const
{
return new TableIncr(*this);
}
/******************** TableDecr ********************/
TableDecr::TableDecr(PIdent *p1, Expr *p2)
{
pident_ = p1;
expr_ = p2;
}
TableDecr::TableDecr(const TableDecr & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
TableDecr &TableDecr::operator=(const TableDecr & other)
{
TableDecr tmp(other);
swap(tmp);
return *this;
}
void TableDecr::swap(TableDecr & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
TableDecr::~TableDecr()
{
delete(pident_);
delete(expr_);
}
void TableDecr::accept(Visitor *v)
{
v->visitTableDecr(this);
}
TableDecr *TableDecr::clone() const
{
return new TableDecr(*this);
}
/******************** Incr ********************/
Incr::Incr(PIdent *p1)
Incr::Incr(Expr *p1)
{
pident_ = p1;
expr_ = p1;
}
Incr::Incr(const Incr & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
......@@ -915,13 +767,13 @@ Incr &Incr::operator=(const Incr & other)
void Incr::swap(Incr & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
Incr::~Incr()
{
delete(pident_);
delete(expr_);
}
......@@ -938,15 +790,15 @@ Incr *Incr::clone() const
/******************** Decr ********************/
Decr::Decr(PIdent *p1)
Decr::Decr(Expr *p1)
{
pident_ = p1;
expr_ = p1;
}
Decr::Decr(const Decr & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
......@@ -959,13 +811,13 @@ Decr &Decr::operator=(const Decr & other)
void Decr::swap(Decr & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
Decr::~Decr()
{
delete(pident_);
delete(expr_);
}
......@@ -1701,140 +1553,113 @@ EVar *EVar::clone() const
/******************** ELitInt ********************/
ELitInt::ELitInt(Integer p1)
{
integer_ = p1;
}
ELitInt::ELitInt(const ELitInt & other)
{
integer_ = other.integer_;
}
ELitInt &ELitInt::operator=(const ELitInt & other)
{
ELitInt tmp(other);
swap(tmp);
return *this;
}
void ELitInt::swap(ELitInt & other)
{
std::swap(integer_, other.integer_);
}
ELitInt::~ELitInt()
{
}
void ELitInt::accept(Visitor *v)
{
v->visitELitInt(this);
}
ELitInt *ELitInt::clone() const
{
return new ELitInt(*this);
}
/******************** ELitTrue ********************/
ELitTrue::ELitTrue()
/******************** EIndexAcc ********************/
EIndexAcc::EIndexAcc(Expr *p1, Expr *p2)
{
expr_1 = p1;
expr_2 = p2;
}
ELitTrue::ELitTrue(const ELitTrue & other)
EIndexAcc::EIndexAcc(const EIndexAcc & other)
{
expr_1 = other.expr_1->clone();
expr_2 = other.expr_2->clone();
}
ELitTrue &ELitTrue::operator=(const ELitTrue & other)
EIndexAcc &EIndexAcc::operator=(const EIndexAcc & other)
{
ELitTrue tmp(other);
swap(tmp);
return *this;
EIndexAcc tmp(other);
swap(tmp);
return *this;
}
void ELitTrue::swap(ELitTrue & other)
void EIndexAcc::swap(EIndexAcc & other)
{
std::swap(expr_1, other.expr_1);
std::swap(expr_2, other.expr_2);
}
ELitTrue::~ELitTrue()
EIndexAcc::~EIndexAcc()
{
delete(expr_1);
delete(expr_2);
}
void ELitTrue::accept(Visitor *v)
void EIndexAcc::accept(Visitor *v)
{
v->visitELitTrue(this);
v->visitEIndexAcc(this);
}
ELitTrue *ELitTrue::clone() const
EIndexAcc *EIndexAcc::clone() const
{
return new ELitTrue(*this);
return new EIndexAcc(*this);
}
/******************** ELitFalse ********************/
ELitFalse::ELitFalse()
/******************** EClsMmbr ********************/
EClsMmbr::EClsMmbr(Expr *p1, PIdent *p2)
{
expr_ = p1;
pident_ = p2;
}
ELitFalse::ELitFalse(const ELitFalse & other)
EClsMmbr::EClsMmbr(const EClsMmbr & other)
{
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
}
ELitFalse &ELitFalse::operator=(const ELitFalse & other)
EClsMmbr &EClsMmbr::operator=(const EClsMmbr & other)
{
ELitFalse tmp(other);
swap(tmp);
return *this;
EClsMmbr tmp(other);
swap(tmp);
return *this;
}
void ELitFalse::swap(ELitFalse & other)
void EClsMmbr::swap(EClsMmbr & other)
{
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
}
ELitFalse::~ELitFalse()
EClsMmbr::~EClsMmbr()
{
delete(expr_);
delete(pident_);
}
void ELitFalse::accept(Visitor *v)
void EClsMmbr::accept(Visitor *v)
{
v->visitELitFalse(this);
v->visitEClsMmbr(this);
}
ELitFalse *ELitFalse::clone() const
EClsMmbr *EClsMmbr::clone() const
{
return new ELitFalse(*this);
return new EClsMmbr(*this);
}
/******************** EApp ********************/
EApp::EApp(PIdent *p1, ListExpr *p2)
EApp::EApp(Expr *p1, ListExpr *p2)
{
pident_ = p1;
expr_ = p1;
listexpr_ = p2;
}
EApp::EApp(const EApp & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
listexpr_ = other.listexpr_->clone();
}
......@@ -1848,14 +1673,14 @@ EApp &EApp::operator=(const EApp & other)
void EApp::swap(EApp & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(listexpr_, other.listexpr_);
}
EApp::~EApp()
{
delete(pident_);
delete(expr_);
delete(listexpr_);
}
......@@ -1872,373 +1697,304 @@ EApp *EApp::clone() const
/******************** EString ********************/
EString::EString(String p1)
/******************** ELitInt ********************/
ELitInt::ELitInt(Integer p1)
{
string_ = p1;
integer_ = p1;
}
EString::EString(const EString & other)
ELitInt::ELitInt(const ELitInt & other)
{
string_ = other.string_;
integer_ = other.integer_;
}
EString &EString::operator=(const EString & other)
ELitInt &ELitInt::operator=(const ELitInt & other)
{
EString tmp(other);
ELitInt tmp(other);
swap(tmp);
return *this;
}
void EString::swap(EString & other)
void ELitInt::swap(ELitInt & other)
{
std::swap(string_, other.string_);
std::swap(integer_, other.integer_);
}
EString::~EString()
ELitInt::~ELitInt()
{
}
void EString::accept(Visitor *v)
void ELitInt::accept(Visitor *v)
{
v->visitEString(this);
v->visitELitInt(this);
}
EString *EString::clone() const
ELitInt *ELitInt::clone() const
{
return new EString(*this);
return new ELitInt(*this);
}
/******************** ENewArray ********************/
ENewArray::ENewArray(Type *p1, Expr *p2)
/******************** ELitTrue ********************/
ELitTrue::ELitTrue()
{
type_ = p1;
expr_ = p2;
}
ENewArray::ENewArray(const ENewArray & other)
ELitTrue::ELitTrue(const ELitTrue & other)
{
type_ = other.type_->clone();
expr_ = other.expr_->clone();
}
ENewArray &ENewArray::operator=(const ENewArray & other)
ELitTrue &ELitTrue::operator=(const ELitTrue & other)
{
ENewArray tmp(other);
ELitTrue tmp(other);
swap(tmp);
return *this;
}
void ENewArray::swap(ENewArray & other)
void ELitTrue::swap(ELitTrue & other)
{
std::swap(type_, other.type_);
std::swap(expr_, other.expr_);
}
ENewArray::~ENewArray()
ELitTrue::~ELitTrue()
{
delete(type_);
delete(expr_);
}
void ENewArray::accept(Visitor *v)
void ELitTrue::accept(Visitor *v)
{
v->visitENewArray(this);
v->visitELitTrue(this);
}
ENewArray *ENewArray::clone() const
ELitTrue *ELitTrue::clone() const
{
return new ENewArray(*this);
return new ELitTrue(*this);
}
/******************** ENewClass ********************/
ENewClass::ENewClass(PIdent *p1)
/******************** ELitFalse ********************/
ELitFalse::ELitFalse()
{
pident_ = p1;
}
ENewClass::ENewClass(const ENewClass & other)
ELitFalse::ELitFalse(const ELitFalse & other)
{
pident_ = other.pident_->clone();
}
ENewClass &ENewClass::operator=(const ENewClass & other)
ELitFalse &ELitFalse::operator=(const ELitFalse & other)
{
ENewClass tmp(other);
ELitFalse tmp(other);
swap(tmp);
return *this;
}
void ENewClass::swap(ENewClass & other)
void ELitFalse::swap(ELitFalse & other)
{
std::swap(pident_, other.pident_);
}
ENewClass::~ENewClass()
ELitFalse::~ELitFalse()
{
delete(pident_);
}
void ENewClass::accept(Visitor *v)
void ELitFalse::accept(Visitor *v)
{
v->visitENewClass(this);
v->visitELitFalse(this);
}
ENewClass *ENewClass::clone() const
ELitFalse *ELitFalse::clone() const
{
return new ENewClass(*this);
return new ELitFalse(*this);
}
/******************** EClsMmbr ********************/
EClsMmbr::EClsMmbr(Expr *p1, PIdent *p2)
/******************** EString ********************/
EString::EString(String p1)
{
expr_ = p1;
pident_ = p2;
string_ = p1;
}
EClsMmbr::EClsMmbr(const EClsMmbr & other)
EString::EString(const EString & other)
{
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
string_ = other.string_;
}
EClsMmbr &EClsMmbr::operator=(const EClsMmbr & other)
EString &EString::operator=(const EString & other)
{
EClsMmbr tmp(other);
EString tmp(other);
swap(tmp);
return *this;
}
void EClsMmbr::swap(EClsMmbr & other)
void EString::swap(EString & other)
{
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(string_, other.string_);
}
EClsMmbr::~EClsMmbr()
EString::~EString()
{
delete(expr_);
delete(pident_);
}
void EClsMmbr::accept(Visitor *v)
void EString::accept(Visitor *v)
{
v->visitEClsMmbr(this);
v->visitEString(this);
}
EClsMmbr *EClsMmbr::clone() const
EString *EString::clone() const
{
return new EClsMmbr(*this);
return new EString(*this);
}
/******************** EClsMthd ********************/
EClsMthd::EClsMthd(Expr *p1, PIdent *p2, ListExpr *p3)
/******************** ENewArray ********************/
ENewArray::ENewArray(Type *p1, Expr *p2)
{
expr_ = p1;
pident_ = p2;
listexpr_ = p3;
type_ = p1;
expr_ = p2;
}
EClsMthd::EClsMthd(const EClsMthd & other)
ENewArray::ENewArray(const ENewArray & other)
{
type_ = other.type_->clone();
expr_ = other.expr_->clone();
pident_ = other.pident_->clone();
listexpr_ = other.listexpr_->clone();
}
EClsMthd &EClsMthd::operator=(const EClsMthd & other)
ENewArray &ENewArray::operator=(const ENewArray & other)
{
EClsMthd tmp(other);
ENewArray tmp(other);
swap(tmp);
return *this;
}
void EClsMthd::swap(EClsMthd & other)
void ENewArray::swap(ENewArray & other)
{
std::swap(type_, other.type_);
std::swap(expr_, other.expr_);
std::swap(pident_, other.pident_);
std::swap(listexpr_, other.listexpr_);
}
EClsMthd::~EClsMthd()
ENewArray::~ENewArray()
{
delete(type_);
delete(expr_);
delete(pident_);
delete(listexpr_);
}
void EClsMthd::accept(Visitor *v)
{
v->visitEClsMthd(this);
}
EClsMthd *EClsMthd::clone() const
{
return new EClsMthd(*this);
}
/******************** Null ********************/
Null::Null()
{
}
Null::Null(const Null & other)
{
}
Null &Null::operator=(const Null & other)
{
Null tmp(other);
swap(tmp);
return *this;
}
void Null::swap(Null & other)
{
}
Null::~Null()
{
}
void Null::accept(Visitor *v)
void ENewArray::accept(Visitor *v)
{
v->visitNull(this);
v->visitENewArray(this);
}
Null *Null::clone() const
ENewArray *ENewArray::clone() const
{
return new Null(*this);
return new ENewArray(*this);
}
/******************** EIndexAcc ********************/
EIndexAcc::EIndexAcc(PIdent *p1, Expr *p2)
/******************** ENewClass ********************/
ENewClass::ENewClass(PIdent *p1)
{
pident_ = p1;
expr_ = p2;
}
EIndexAcc::EIndexAcc(const EIndexAcc & other)
ENewClass::ENewClass(const ENewClass & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
}
EIndexAcc &EIndexAcc::operator=(const EIndexAcc & other)
ENewClass &ENewClass::operator=(const ENewClass & other)
{
EIndexAcc tmp(other);
ENewClass tmp(other);
swap(tmp);
return *this;
}
void EIndexAcc::swap(EIndexAcc & other)
void ENewClass::swap(ENewClass & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
}
EIndexAcc::~EIndexAcc()
ENewClass::~ENewClass()
{
delete(pident_);
delete(expr_);
}
void EIndexAcc::accept(Visitor *v)
void ENewClass::accept(Visitor *v)
{
v->visitEIndexAcc(this);
v->visitENewClass(this);
}
EIndexAcc *EIndexAcc::clone() const
ENewClass *ENewClass::clone() const
{
return new EIndexAcc(*this);
return new ENewClass(*this);
}
/******************** ECast ********************/
ECast::ECast(PIdent *p1, Expr *p2)
/******************** NullCast ********************/
NullCast::NullCast(Expr *p1)
{
pident_ = p1;
expr_ = p2;
expr_ = p1;
}
ECast::ECast(const ECast & other)
NullCast::NullCast(const NullCast & other)
{
pident_ = other.pident_->clone();
expr_ = other.expr_->clone();
expr_ = other.expr_->clone();
}
ECast &ECast::operator=(const ECast & other)
NullCast &NullCast::operator=(const NullCast & other)
{
ECast tmp(other);
swap(tmp);
return *this;
NullCast tmp(other);
swap(tmp);
return *this;
}
void ECast::swap(ECast & other)
void NullCast::swap(NullCast & other)
{
std::swap(pident_, other.pident_);
std::swap(expr_, other.expr_);
std::swap(expr_, other.expr_);
}
ECast::~ECast()
NullCast::~NullCast()
{
delete(pident_);
delete(expr_);
delete(expr_);
}
void ECast::accept(Visitor *v)
void NullCast::accept(Visitor *v)
{
v->visitECast(this);
v->visitNullCast(this);
}
ECast *ECast::clone() const
NullCast *NullCast::clone() const
{
return new ECast(*this);
return new NullCast(*this);
}
......
......@@ -60,9 +60,6 @@ public:
virtual void visitNoInit(NoInit *p) = 0;
virtual void visitInit(Init *p) = 0;
virtual void visitAss(Ass *p) = 0;
virtual void visitTableAss(TableAss *p) = 0;
virtual void visitTableIncr(TableIncr *p) = 0;
virtual void visitTableDecr(TableDecr *p) = 0;
virtual void visitIncr(Incr *p) = 0;
virtual void visitDecr(Decr *p) = 0;
virtual void visitRet(Ret *p) = 0;
......@@ -80,18 +77,16 @@ public:
virtual void visitClassT(ClassT *p) = 0;
virtual void visitFun(Fun *p) = 0;
virtual void visitEVar(EVar *p) = 0;
virtual void visitEIndexAcc(EIndexAcc *p) = 0;
virtual void visitEClsMmbr(EClsMmbr *p) = 0;
virtual void visitEApp(EApp *p) = 0;
virtual void visitELitInt(ELitInt *p) = 0;
virtual void visitELitTrue(ELitTrue *p) = 0;
virtual void visitELitFalse(ELitFalse *p) = 0;
virtual void visitEApp(EApp *p) = 0;
virtual void visitEString(EString *p) = 0;
virtual void visitENewArray(ENewArray *p) = 0;
virtual void visitENewClass(ENewClass *p) = 0;
virtual void visitEClsMmbr(EClsMmbr *p) = 0;
virtual void visitEClsMthd(EClsMthd *p) = 0;
virtual void visitNull(Null *p) = 0;
virtual void visitEIndexAcc(EIndexAcc *p) = 0;
virtual void visitECast(ECast *p) = 0;
virtual void visitNullCast(NullCast *p) = 0;
virtual void visitNeg(Neg *p) = 0;
virtual void visitNot(Not *p) = 0;
virtual void visitEMul(EMul *p) = 0;
......@@ -131,7 +126,7 @@ public:
class Visitable
{
public:
public:
virtual ~Visitable() {}
virtual void accept(Visitor *v) = 0;
};
......@@ -508,60 +503,14 @@ public:
void swap(Ass &);
};
class TableAss : public Stmt
{
public:
PIdent *pident_;
Expr *expr_1;
Expr *expr_2;
TableAss(const TableAss &);
TableAss &operator=(const TableAss &);
TableAss(PIdent *p1, Expr *p2, Expr *p3);
~TableAss();
virtual void accept(Visitor *v);
virtual TableAss *clone() const;
void swap(TableAss &);
};
class TableIncr : public Stmt
{
public:
PIdent *pident_;
Expr *expr_;
TableIncr(const TableIncr &);
TableIncr &operator=(const TableIncr &);
TableIncr(PIdent *p1, Expr *p2);
~TableIncr();
virtual void accept(Visitor *v);
virtual TableIncr *clone() const;
void swap(TableIncr &);
};
class TableDecr : public Stmt
{
public:
PIdent *pident_;
Expr *expr_;
TableDecr(const TableDecr &);
TableDecr &operator=(const TableDecr &);
TableDecr(PIdent *p1, Expr *p2);
~TableDecr();
virtual void accept(Visitor *v);
virtual TableDecr *clone() const;
void swap(TableDecr &);
};
class Incr : public Stmt
{
public:
PIdent *pident_;
Expr *expr_;
Incr(const Incr &);
Incr &operator=(const Incr &);
Incr(PIdent *p1);
Incr(Expr *p1);
~Incr();
virtual void accept(Visitor *v);
virtual Incr *clone() const;
......@@ -571,11 +520,11 @@ public:
class Decr : public Stmt
{
public:
PIdent *pident_;
Expr *expr_;
Decr(const Decr &);
Decr &operator=(const Decr &);
Decr(PIdent *p1);
Decr(Expr *p1);
~Decr();
virtual void accept(Visitor *v);
virtual Decr *clone() const;
......@@ -831,6 +780,52 @@ public:
void swap(EVar &);
};
class EIndexAcc : public Expr
{
public:
Expr *expr_1;
Expr *expr_2;
EIndexAcc(const EIndexAcc &);
EIndexAcc &operator=(const EIndexAcc &);
EIndexAcc(Expr *p1, Expr *p2);
~EIndexAcc();
virtual void accept(Visitor *v);
virtual EIndexAcc *clone() const;
void swap(EIndexAcc &);
};
class EClsMmbr : public Expr
{
public:
Expr *expr_;
PIdent *pident_;
EClsMmbr(const EClsMmbr &);
EClsMmbr &operator=(const EClsMmbr &);
EClsMmbr(Expr *p1, PIdent *p2);
~EClsMmbr();
virtual void accept(Visitor *v);
virtual EClsMmbr *clone() const;
void swap(EClsMmbr &);
};
class EApp : public Expr
{
public:
Expr *expr_;
ListExpr *listexpr_;
EApp(const EApp &);
EApp &operator=(const EApp &);
EApp(Expr *p1, ListExpr *p2);
~EApp();
virtual void accept(Visitor *v);
virtual EApp *clone() const;
void swap(EApp &);
};
class ELitInt : public Expr
{
public:
......@@ -871,21 +866,6 @@ public:
void swap(ELitFalse &);
};
class EApp : public Expr
{
public:
PIdent *pident_;
ListExpr *listexpr_;
EApp(const EApp &);
EApp &operator=(const EApp &);
EApp(PIdent *p1, ListExpr *p2);
~EApp();
virtual void accept(Visitor *v);
virtual EApp *clone() const;
void swap(EApp &);
};
class EString : public Expr
{
public:
......@@ -929,78 +909,18 @@ public:
void swap(ENewClass &);
};
class EClsMmbr : public Expr
class NullCast : public Expr
{
public:
Expr *expr_;
PIdent *pident_;
EClsMmbr(const EClsMmbr &);
EClsMmbr &operator=(const EClsMmbr &);
EClsMmbr(Expr *p1, PIdent *p2);
~EClsMmbr();
virtual void accept(Visitor *v);
virtual EClsMmbr *clone() const;
void swap(EClsMmbr &);
};
class EClsMthd : public Expr
{
public:
Expr *expr_;
PIdent *pident_;
ListExpr *listexpr_;
EClsMthd(const EClsMthd &);
EClsMthd &operator=(const EClsMthd &);
EClsMthd(Expr *p1, PIdent *p2, ListExpr *p3);
~EClsMthd();
virtual void accept(Visitor *v);
virtual EClsMthd *clone() const;
void swap(EClsMthd &);
};
class Null : public Expr
{
public:
Null(const Null &);
Null &operator=(const Null &);
Null();
~Null();
virtual void accept(Visitor *v);
virtual Null *clone() const;
void swap(Null &);
};
class EIndexAcc : public Expr
{
public:
PIdent *pident_;
Expr *expr_;
EIndexAcc(const EIndexAcc &);
EIndexAcc &operator=(const EIndexAcc &);
EIndexAcc(PIdent *p1, Expr *p2);
~EIndexAcc();
virtual void accept(Visitor *v);
virtual EIndexAcc *clone() const;
void swap(EIndexAcc &);
};
class ECast : public Expr
{
public:
PIdent *pident_;
Expr *expr_;
ECast(const ECast &);
ECast &operator=(const ECast &);
ECast(PIdent *p1, Expr *p2);
~ECast();
NullCast(const NullCast &);
NullCast &operator=(const NullCast &);
NullCast(Expr *p1);
~NullCast();
virtual void accept(Visitor *v);
virtual ECast *clone() const;
void swap(ECast &);
virtual NullCast *clone() const;
void swap(NullCast &);
};
class Neg : public Expr
......
......@@ -352,8 +352,8 @@ static void yynoreturn yy_fatal_error ( const char* msg );
(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
(yy_c_buf_p) = yy_cp;
#define YY_NUM_RULES 63
#define YY_END_OF_BUFFER 64
#define YY_NUM_RULES 64
#define YY_END_OF_BUFFER 65
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
......@@ -361,23 +361,24 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
static const flex_int16_t yy_accept[141] =
static const flex_int16_t yy_accept[142] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 64, 63, 60, 62,
61, 60, 15, 50, 62, 21, 62, 1, 2, 19,
18, 3, 14, 13, 20, 59, 12, 6, 22, 7,
24, 49, 8, 9, 49, 49, 49, 49, 49, 49,
49, 49, 49, 49, 49, 4, 62, 5, 47, 48,
47, 53, 52, 51, 58, 55, 56, 54, 57, 27,
0, 43, 16, 10, 11, 45, 0, 59, 23, 26,
25, 49, 49, 49, 49, 49, 49, 49, 34, 49,
49, 49, 49, 49, 49, 49, 49, 17, 46, 0,
44, 49, 49, 49, 49, 49, 33, 35, 36, 49,
49, 49, 49, 49, 49, 49, 49, 30, 49, 49,
37, 49, 49, 40, 41, 49, 49, 29, 49, 32,
49, 49, 42, 49, 49, 38, 39, 28, 31, 0
0, 0, 0, 0, 0, 0, 65, 64, 61, 63,
62, 61, 16, 51, 63, 22, 63, 1, 2, 20,
19, 3, 15, 14, 21, 60, 10, 6, 23, 7,
25, 50, 12, 13, 50, 50, 50, 50, 50, 50,
50, 50, 50, 50, 50, 4, 63, 5, 48, 49,
48, 54, 53, 52, 59, 56, 57, 55, 58, 28,
0, 44, 17, 8, 9, 46, 0, 60, 24, 27,
26, 50, 11, 50, 50, 50, 50, 50, 50, 35,
50, 50, 50, 50, 50, 50, 50, 50, 18, 47,
0, 45, 50, 50, 50, 50, 50, 34, 36, 37,
50, 50, 50, 50, 50, 50, 50, 50, 31, 50,
50, 38, 50, 50, 41, 42, 50, 50, 30, 50,
33, 50, 50, 43, 50, 50, 39, 40, 29, 32,
0
} ;
static const YY_CHAR yy_ec[256] =
......@@ -421,47 +422,47 @@ static const YY_CHAR yy_meta[51] =
2, 2, 2, 2, 2, 2, 2, 1, 1, 1
} ;
static const flex_int16_t yy_base[148] =
static const flex_int16_t yy_base[149] =
{ 0,
159, 158, 0, 0, 48, 49, 157, 156, 155, 154,
153, 152, 50, 51, 54, 59, 154, 163, 163, 163,
163, 163, 131, 163, 149, 163, 143, 163, 163, 163,
137, 163, 134, 163, 46, 130, 163, 163, 125, 124,
123, 0, 163, 163, 104, 105, 27, 38, 32, 35,
109, 98, 99, 99, 102, 163, 88, 163, 163, 163,
119, 163, 163, 163, 163, 163, 163, 163, 163, 163,
132, 163, 163, 163, 163, 163, 131, 115, 163, 163,
163, 0, 92, 102, 88, 86, 90, 86, 0, 83,
79, 86, 80, 81, 77, 83, 82, 163, 163, 115,
163, 79, 74, 82, 68, 58, 0, 0, 0, 61,
52, 58, 61, 60, 53, 57, 47, 0, 49, 54,
0, 45, 45, 0, 0, 50, 53, 0, 49, 0,
36, 38, 0, 33, 28, 0, 0, 0, 0, 163,
102, 104, 106, 108, 110, 67, 112
160, 159, 0, 0, 48, 49, 158, 157, 156, 155,
154, 153, 50, 51, 54, 59, 155, 164, 164, 164,
164, 164, 132, 164, 150, 164, 144, 164, 164, 164,
138, 164, 135, 164, 46, 131, 164, 164, 126, 125,
124, 0, 118, 164, 104, 105, 27, 38, 32, 35,
109, 98, 99, 99, 102, 164, 88, 164, 164, 164,
119, 164, 164, 164, 164, 164, 164, 164, 164, 164,
132, 164, 164, 164, 164, 164, 131, 115, 164, 164,
164, 0, 164, 92, 102, 88, 86, 90, 86, 0,
83, 79, 86, 80, 81, 77, 83, 82, 164, 164,
115, 164, 79, 74, 82, 68, 58, 0, 0, 0,
61, 52, 58, 61, 60, 53, 57, 47, 0, 49,
54, 0, 45, 45, 0, 0, 50, 53, 0, 49,
0, 36, 38, 0, 33, 28, 0, 0, 0, 0,
164, 102, 104, 106, 108, 110, 67, 112
} ;
static const flex_int16_t yy_def[148] =
static const flex_int16_t yy_def[149] =
{ 0,
141, 141, 140, 3, 142, 142, 141, 141, 141, 141,
141, 141, 143, 143, 144, 144, 140, 140, 140, 140,
140, 140, 140, 140, 145, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 146, 140, 140, 146, 146, 146, 146, 146, 146,
146, 146, 146, 146, 146, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
145, 140, 140, 140, 140, 140, 147, 140, 140, 140,
140, 146, 146, 146, 146, 146, 146, 146, 146, 146,
146, 146, 146, 146, 146, 146, 146, 140, 140, 147,
140, 146, 146, 146, 146, 146, 146, 146, 146, 146,
146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
146, 146, 146, 146, 146, 146, 146, 146, 146, 0,
140, 140, 140, 140, 140, 140, 140
142, 142, 141, 3, 143, 143, 142, 142, 142, 142,
142, 142, 144, 144, 145, 145, 141, 141, 141, 141,
141, 141, 141, 141, 146, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 147, 141, 141, 147, 147, 147, 147, 147, 147,
147, 147, 147, 147, 147, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
146, 141, 141, 141, 141, 141, 148, 141, 141, 141,
141, 147, 141, 147, 147, 147, 147, 147, 147, 147,
147, 147, 147, 147, 147, 147, 147, 147, 141, 141,
148, 141, 147, 147, 147, 147, 147, 147, 147, 147,
147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
0, 141, 141, 141, 141, 141, 141, 141
} ;
static const flex_int16_t yy_nxt[214] =
static const flex_int16_t yy_nxt[215] =
{ 0,
20, 21, 22, 23, 24, 25, 26, 27, 20, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
......@@ -469,27 +470,27 @@ static const flex_int16_t yy_nxt[214] =
46, 42, 47, 48, 42, 42, 49, 42, 50, 42,
51, 52, 53, 42, 54, 55, 42, 56, 57, 58,
60, 60, 19, 19, 63, 63, 19, 76, 66, 61,
61, 19, 77, 66, 85, 89, 87, 91, 82, 139,
90, 138, 137, 86, 136, 64, 64, 88, 92, 67,
135, 134, 133, 132, 67, 131, 130, 129, 128, 127,
126, 125, 68, 124, 123, 122, 69, 68, 121, 120,
119, 69, 18, 18, 59, 59, 62, 62, 65, 65,
71, 71, 100, 100, 118, 117, 116, 101, 115, 114,
113, 112, 111, 110, 109, 108, 107, 106, 105, 104,
103, 102, 78, 101, 72, 99, 98, 97, 96, 95,
94, 93, 84, 83, 81, 80, 79, 78, 75, 74,
73, 72, 70, 140, 19, 19, 19, 19, 19, 19,
19, 19, 17, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140
61, 19, 77, 66, 86, 90, 88, 92, 82, 140,
91, 139, 138, 87, 137, 64, 64, 89, 93, 67,
136, 135, 134, 133, 67, 132, 131, 130, 129, 128,
127, 126, 68, 125, 124, 123, 69, 68, 122, 121,
120, 69, 18, 18, 59, 59, 62, 62, 65, 65,
71, 71, 101, 101, 119, 118, 117, 102, 116, 115,
114, 113, 112, 111, 110, 109, 108, 107, 106, 105,
104, 103, 78, 102, 72, 100, 99, 98, 97, 96,
95, 94, 85, 84, 83, 81, 80, 79, 78, 75,
74, 73, 72, 70, 141, 19, 19, 19, 19, 19,
19, 19, 19, 17, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141
} ;
static const flex_int16_t yy_chk[214] =
static const flex_int16_t yy_chk[215] =
{ 0,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
......@@ -497,24 +498,24 @@ static const flex_int16_t yy_chk[214] =
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
5, 6, 13, 14, 13, 14, 15, 35, 15, 5,
6, 16, 35, 16, 47, 49, 48, 50, 146, 135,
49, 134, 132, 47, 131, 13, 14, 48, 50, 15,
129, 127, 126, 123, 16, 122, 120, 119, 117, 116,
115, 114, 15, 113, 112, 111, 15, 16, 110, 106,
105, 16, 141, 141, 142, 142, 143, 143, 144, 144,
145, 145, 147, 147, 104, 103, 102, 100, 97, 96,
95, 94, 93, 92, 91, 90, 88, 87, 86, 85,
84, 83, 78, 77, 71, 61, 57, 55, 54, 53,
52, 51, 46, 45, 41, 40, 39, 36, 33, 31,
27, 25, 23, 17, 12, 11, 10, 9, 8, 7,
2, 1, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140
6, 16, 35, 16, 47, 49, 48, 50, 147, 136,
49, 135, 133, 47, 132, 13, 14, 48, 50, 15,
130, 128, 127, 124, 16, 123, 121, 120, 118, 117,
116, 115, 15, 114, 113, 112, 15, 16, 111, 107,
106, 16, 142, 142, 143, 143, 144, 144, 145, 145,
146, 146, 148, 148, 105, 104, 103, 101, 98, 97,
96, 95, 94, 93, 92, 91, 89, 88, 87, 86,
85, 84, 78, 77, 71, 61, 57, 55, 54, 53,
52, 51, 46, 45, 43, 41, 40, 39, 36, 33,
31, 27, 25, 23, 17, 12, 11, 10, 9, 8,
7, 2, 1, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141, 141, 141, 141, 141, 141, 141,
141, 141, 141, 141
} ;
static yy_state_type yy_last_accepting_state;
......@@ -549,9 +550,9 @@ static void YY_BUFFER_RESET(void)
YY_PARSED_STRING[x] = 0;
}
#line 552 "Lexer.cpp"
#line 553 "Lexer.cpp"
#line 554 "Lexer.cpp"
#line 555 "Lexer.cpp"
#define INITIAL 0
#define YYINITIAL 1
......@@ -778,7 +779,7 @@ YY_DECL
#line 27 "Grammar.l"
#line 781 "Lexer.cpp"
#line 782 "Lexer.cpp"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
......@@ -805,13 +806,13 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 141 )
if ( yy_current_state >= 142 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 163 );
while ( yy_base[yy_current_state] != 164 );
yy_find_action:
yy_act = yy_accept[yy_current_state];
......@@ -1046,116 +1047,121 @@ YY_RULE_SETUP
return _SYMB_41;
YY_BREAK
case 43:
/* rule 43 can match eol */
YY_RULE_SETUP
#line 72 "Grammar.l"
++yy_mylinenumber; // BNFC: comment "#";
#line 71 "Grammar.l"
return _SYMB_42;
YY_BREAK
case 44:
/* rule 44 can match eol */
YY_RULE_SETUP
#line 73 "Grammar.l"
++yy_mylinenumber; // BNFC: comment "//";
++yy_mylinenumber; // BNFC: comment "#";
YY_BREAK
case 45:
/* rule 45 can match eol */
YY_RULE_SETUP
#line 74 "Grammar.l"
BEGIN COMMENT; // BNFC: comment "/*" "*/";
++yy_mylinenumber; // BNFC: comment "//";
YY_BREAK
case 46:
YY_RULE_SETUP
#line 75 "Grammar.l"
BEGIN YYINITIAL;
BEGIN COMMENT; // BNFC: comment "/*" "*/";
YY_BREAK
case 47:
YY_RULE_SETUP
#line 76 "Grammar.l"
/* skip */;
BEGIN YYINITIAL;
YY_BREAK
case 48:
/* rule 48 can match eol */
YY_RULE_SETUP
#line 77 "Grammar.l"
++yy_mylinenumber;
/* skip */;
YY_BREAK
case 49:
/* rule 49 can match eol */
YY_RULE_SETUP
#line 79 "Grammar.l"
yylval.string_ = strdup(yytext); return _SYMB_42;
#line 78 "Grammar.l"
++yy_mylinenumber;
YY_BREAK
case 50:
YY_RULE_SETUP
#line 80 "Grammar.l"
BEGIN STRING;
yylval.string_ = strdup(yytext); return _SYMB_43;
YY_BREAK
case 51:
YY_RULE_SETUP
#line 81 "Grammar.l"
BEGIN ESCAPED;
BEGIN STRING;
YY_BREAK
case 52:
YY_RULE_SETUP
#line 82 "Grammar.l"
yylval.string_ = strdup(YY_PARSED_STRING); YY_BUFFER_RESET(); BEGIN YYINITIAL; return _STRING_;
BEGIN ESCAPED;
YY_BREAK
case 53:
YY_RULE_SETUP
#line 83 "Grammar.l"
YY_BUFFER_APPEND(yytext);
yylval.string_ = strdup(YY_PARSED_STRING); YY_BUFFER_RESET(); BEGIN YYINITIAL; return _STRING_;
YY_BREAK
case 54:
YY_RULE_SETUP
#line 84 "Grammar.l"
YY_BUFFER_APPEND("\n"); BEGIN STRING;
YY_BUFFER_APPEND(yytext);
YY_BREAK
case 55:
YY_RULE_SETUP
#line 85 "Grammar.l"
YY_BUFFER_APPEND("\""); BEGIN STRING ;
YY_BUFFER_APPEND("\n"); BEGIN STRING;
YY_BREAK
case 56:
YY_RULE_SETUP
#line 86 "Grammar.l"
YY_BUFFER_APPEND("\\"); BEGIN STRING;
YY_BUFFER_APPEND("\""); BEGIN STRING ;
YY_BREAK
case 57:
YY_RULE_SETUP
#line 87 "Grammar.l"
YY_BUFFER_APPEND("\t"); BEGIN STRING;
YY_BUFFER_APPEND("\\"); BEGIN STRING;
YY_BREAK
case 58:
YY_RULE_SETUP
#line 88 "Grammar.l"
YY_BUFFER_APPEND(yytext); BEGIN STRING;
YY_BUFFER_APPEND("\t"); BEGIN STRING;
YY_BREAK
case 59:
YY_RULE_SETUP
#line 89 "Grammar.l"
yylval.int_ = atoi(yytext); return _INTEGER_;
YY_BUFFER_APPEND(yytext); BEGIN STRING;
YY_BREAK
case 60:
/* rule 60 can match eol */
YY_RULE_SETUP
#line 90 "Grammar.l"
++yy_mylinenumber ;
yylval.int_ = atoi(yytext); return _INTEGER_;
YY_BREAK
case 61:
/* rule 61 can match eol */
YY_RULE_SETUP
#line 91 "Grammar.l"
/* ignore white space. */;
++yy_mylinenumber ;
YY_BREAK
case 62:
/* rule 62 can match eol */
YY_RULE_SETUP
#line 92 "Grammar.l"
return _ERROR_;
/* ignore white space. */;
YY_BREAK
case 63:
YY_RULE_SETUP
#line 93 "Grammar.l"
return _ERROR_;
YY_BREAK
case 64:
YY_RULE_SETUP
#line 94 "Grammar.l"
ECHO;
YY_BREAK
#line 1158 "Lexer.cpp"
#line 1164 "Lexer.cpp"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(YYINITIAL):
case YY_STATE_EOF(COMMENT):
......@@ -1459,7 +1465,7 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 141 )
if ( yy_current_state >= 142 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
......@@ -1487,11 +1493,11 @@ static int yy_get_next_buffer (void)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 141 )
if ( yy_current_state >= 142 )
yy_c = yy_meta[yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 140);
yy_is_jam = (yy_current_state == 141);
return yy_is_jam ? 0 : yy_current_state;
}
......@@ -2167,9 +2173,8 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 93 "Grammar.l"
#line 94 "Grammar.l"
void initialize_lexer(FILE *inp) { yyrestart(inp); BEGIN YYINITIAL; }
int yywrap(void) { return 1; }
......@@ -52,7 +52,7 @@
#define YYBISON_VERSION "3.7.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.cpp"
#define YYSKELETON_NAME "yacc.c"
/* Pure parsers. */
#define YYPURE 0
......@@ -249,8 +249,9 @@ extern int yydebug;
_SYMB_40 = 299, /* _SYMB_40 */
_SYMB_41 = 300, /* _SYMB_41 */
_SYMB_42 = 301, /* _SYMB_42 */
_STRING_ = 302, /* _STRING_ */
_INTEGER_ = 303 /* _INTEGER_ */
_SYMB_43 = 302, /* _SYMB_43 */
_STRING_ = 303, /* _STRING_ */
_INTEGER_ = 304 /* _INTEGER_ */
};
typedef enum yytokentype yytoken_kind_t;
#endif
......@@ -289,7 +290,7 @@ union YYSTYPE
MulOp* mulop_;
RelOp* relop_;
#line 293 "Parser.cpp"
#line 294 "Parser.cpp"
};
typedef union YYSTYPE YYSTYPE;
......@@ -354,37 +355,39 @@ enum yysymbol_kind_t
YYSYMBOL__SYMB_40 = 44, /* _SYMB_40 */
YYSYMBOL__SYMB_41 = 45, /* _SYMB_41 */
YYSYMBOL__SYMB_42 = 46, /* _SYMB_42 */
YYSYMBOL__STRING_ = 47, /* _STRING_ */
YYSYMBOL__INTEGER_ = 48, /* _INTEGER_ */
YYSYMBOL_YYACCEPT = 49, /* $accept */
YYSYMBOL_Program = 50, /* Program */
YYSYMBOL_TopDef = 51, /* TopDef */
YYSYMBOL_ListTopDef = 52, /* ListTopDef */
YYSYMBOL_FunDef = 53, /* FunDef */
YYSYMBOL_Arg = 54, /* Arg */
YYSYMBOL_ListArg = 55, /* ListArg */
YYSYMBOL_ClassDef = 56, /* ClassDef */
YYSYMBOL_ClassBlock = 57, /* ClassBlock */
YYSYMBOL_ClassBlockDef = 58, /* ClassBlockDef */
YYSYMBOL_ListClassBlockDef = 59, /* ListClassBlockDef */
YYSYMBOL_Block = 60, /* Block */
YYSYMBOL_ListStmt = 61, /* ListStmt */
YYSYMBOL_Stmt = 62, /* Stmt */
YYSYMBOL_Item = 63, /* Item */
YYSYMBOL_ListItem = 64, /* ListItem */
YYSYMBOL_Type = 65, /* Type */
YYSYMBOL_Expr6 = 66, /* Expr6 */
YYSYMBOL_Expr5 = 67, /* Expr5 */
YYSYMBOL_Expr4 = 68, /* Expr4 */
YYSYMBOL_Expr3 = 69, /* Expr3 */
YYSYMBOL_Expr2 = 70, /* Expr2 */
YYSYMBOL_Expr1 = 71, /* Expr1 */
YYSYMBOL_Expr = 72, /* Expr */
YYSYMBOL_ListExpr = 73, /* ListExpr */
YYSYMBOL_AddOp = 74, /* AddOp */
YYSYMBOL_MulOp = 75, /* MulOp */
YYSYMBOL_RelOp = 76, /* RelOp */
YYSYMBOL_PIdent = 77 /* PIdent */
YYSYMBOL__SYMB_43 = 47, /* _SYMB_43 */
YYSYMBOL__STRING_ = 48, /* _STRING_ */
YYSYMBOL__INTEGER_ = 49, /* _INTEGER_ */
YYSYMBOL_YYACCEPT = 50, /* $accept */
YYSYMBOL_Program = 51, /* Program */
YYSYMBOL_TopDef = 52, /* TopDef */
YYSYMBOL_ListTopDef = 53, /* ListTopDef */
YYSYMBOL_FunDef = 54, /* FunDef */
YYSYMBOL_Arg = 55, /* Arg */
YYSYMBOL_ListArg = 56, /* ListArg */
YYSYMBOL_ClassDef = 57, /* ClassDef */
YYSYMBOL_ClassBlock = 58, /* ClassBlock */
YYSYMBOL_ClassBlockDef = 59, /* ClassBlockDef */
YYSYMBOL_ListClassBlockDef = 60, /* ListClassBlockDef */
YYSYMBOL_Block = 61, /* Block */
YYSYMBOL_ListStmt = 62, /* ListStmt */
YYSYMBOL_Stmt = 63, /* Stmt */
YYSYMBOL_Item = 64, /* Item */
YYSYMBOL_ListItem = 65, /* ListItem */
YYSYMBOL_Type = 66, /* Type */
YYSYMBOL_Expr7 = 67, /* Expr7 */
YYSYMBOL_Expr6 = 68, /* Expr6 */
YYSYMBOL_Expr5 = 69, /* Expr5 */
YYSYMBOL_Expr4 = 70, /* Expr4 */
YYSYMBOL_Expr3 = 71, /* Expr3 */
YYSYMBOL_Expr2 = 72, /* Expr2 */
YYSYMBOL_Expr1 = 73, /* Expr1 */
YYSYMBOL_Expr = 74, /* Expr */
YYSYMBOL_ListExpr = 75, /* ListExpr */
YYSYMBOL_AddOp = 76, /* AddOp */
YYSYMBOL_MulOp = 77, /* MulOp */
YYSYMBOL_RelOp = 78, /* RelOp */
YYSYMBOL_PIdent = 79 /* PIdent */
};
typedef enum yysymbol_kind_t yysymbol_kind_t;
......@@ -533,7 +536,7 @@ typedef int yy_state_fast_t;
#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic pu.h") \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
......@@ -551,7 +554,7 @@ typedef int yy_state_fast_t;
#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
# define YY_IGNORE_USELESS_CAST_BEGIN \
_Pragma ("GCC diagnostic pu.h") \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
# define YY_IGNORE_USELESS_CAST_END \
_Pragma ("GCC diagnostic pop")
......@@ -694,19 +697,19 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 15
/* YYLAST -- Last index in YYTABLE. */
#define YYLAST 251
#define YYLAST 206
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 49
#define YYNTOKENS 50
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS 29
#define YYNNTS 30
/* YYNRULES -- Number of rules. */
#define YYNRULES 89
#define YYNRULES 85
/* YYNSTATES -- Number of states. */
#define YYNSTATES 165
#define YYNSTATES 151
/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 303
#define YYMAXUTOK 304
/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
......@@ -750,22 +753,22 @@ static const yytype_int8 yytranslate[] =
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
45, 46, 47, 48
45, 46, 47, 48, 49
};
#if YYDEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int16 yyrline[] =
{
0, 210, 210, 212, 213, 215, 216, 218, 220, 222,
223, 224, 226, 227, 229, 231, 232, 234, 235, 237,
239, 240, 242, 243, 244, 245, 246, 247, 248, 249,
250, 251, 252, 253, 254, 255, 256, 257, 259, 260,
262, 263, 265, 266, 267, 268, 269, 270, 276, 277,
278, 279, 280, 281, 282, 283, 284, 285, 286, 287,
288, 290, 291, 292, 293, 295, 296, 298, 299, 301,
302, 304, 305, 307, 308, 310, 311, 312, 314, 315,
317, 318, 319, 321, 322, 323, 324, 325, 326, 328
0, 212, 212, 214, 215, 217, 218, 220, 222, 224,
225, 226, 228, 229, 231, 233, 234, 236, 237, 239,
241, 242, 244, 245, 246, 247, 248, 249, 250, 251,
252, 253, 254, 255, 256, 258, 259, 261, 262, 264,
265, 266, 267, 268, 269, 275, 276, 277, 278, 279,
281, 282, 283, 284, 285, 286, 287, 289, 290, 291,
292, 294, 295, 297, 298, 300, 301, 303, 304, 306,
307, 309, 310, 311, 313, 314, 316, 317, 318, 320,
321, 322, 323, 324, 325, 327
};
#endif
......@@ -789,11 +792,12 @@ static const char *const yytname[] =
"_SYMB_25", "_SYMB_26", "_SYMB_27", "_SYMB_28", "_SYMB_29", "_SYMB_30",
"_SYMB_31", "_SYMB_32", "_SYMB_33", "_SYMB_34", "_SYMB_35", "_SYMB_36",
"_SYMB_37", "_SYMB_38", "_SYMB_39", "_SYMB_40", "_SYMB_41", "_SYMB_42",
"_STRING_", "_INTEGER_", "$accept", "Program", "TopDef", "ListTopDef",
"FunDef", "Arg", "ListArg", "ClassDef", "ClassBlock", "ClassBlockDef",
"ListClassBlockDef", "Block", "ListStmt", "Stmt", "Item", "ListItem",
"Type", "Expr6", "Expr5", "Expr4", "Expr3", "Expr2", "Expr1", "Expr",
"ListExpr", "AddOp", "MulOp", "RelOp", "PIdent", YY_NULLPTR
"_SYMB_43", "_STRING_", "_INTEGER_", "$accept", "Program", "TopDef",
"ListTopDef", "FunDef", "Arg", "ListArg", "ClassDef", "ClassBlock",
"ClassBlockDef", "ListClassBlockDef", "Block", "ListStmt", "Stmt",
"Item", "ListItem", "Type", "Expr7", "Expr6", "Expr5", "Expr4", "Expr3",
"Expr2", "Expr1", "Expr", "ListExpr", "AddOp", "MulOp", "RelOp",
"PIdent", YY_NULLPTR
};
static const char *
......@@ -812,16 +816,16 @@ static const yytype_int16 yytoknum[] =
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
295, 296, 297, 298, 299, 300, 301, 302, 303
295, 296, 297, 298, 299, 300, 301, 302, 303, 304
};
#endif
#define YYPACT_NINF (-89)
#define YYPACT_NINF (-46)
#define yypact_value_is_default(Yyn) \
((Yyn) == YYPACT_NINF)
#define YYTABLE_NINF (-48)
#define YYTABLE_NINF (-45)
#define yytable_value_is_error(Yyn) \
0
......@@ -830,23 +834,22 @@ static const yytype_int16 yytoknum[] =
STATE-NUM. */
static const yytype_int16 yypact[] =
{
124, -89, -35, -89, -89, -89, -89, 17, 124, -89,
-89, -89, -8, -89, -3, -89, -89, 10, 35, -89,
-35, -89, -89, 76, 81, 20, 44, 77, -8, -89,
-89, -89, -8, -89, 76, 74, -89, 79, 82, 3,
-89, -89, -89, -35, -89, 203, 93, -89, 80, 203,
40, 40, -89, 76, -89, -89, -89, -89, 83, -89,
54, 4, 189, 72, -89, 41, -89, -89, 91, 92,
156, 94, -89, -89, -8, 38, 5, 99, 57, 203,
83, 83, 95, 102, -35, -89, -89, -89, 203, -89,
-89, 203, 203, -89, -89, -89, -89, -89, -89, 203,
203, 203, 203, 76, 203, -89, 106, 203, 107, -89,
203, 203, 108, 112, -89, 203, 188, 140, -89, 54,
-89, 4, -89, 143, 142, 134, -8, 146, -89, 147,
-89, 144, 151, -89, -89, -89, 152, 203, 203, -89,
-89, 139, 141, 141, -89, 23, -89, 162, -89, 203,
136, -89, 203, 166, 181, -89, 192, 141, 184, -89,
-89, 141, -89, -89, -89
-15, -46, -31, -46, -46, -46, -46, 19, -15, -46,
-46, -46, -13, -46, 6, -46, -46, -46, 17, -46,
-31, -46, 38, 159, 32, 23, 45, -13, -46, -46,
-46, -13, -46, 38, 40, -46, 63, 44, 5, -46,
-46, -46, -31, -46, 152, 88, -46, 62, 152, 113,
113, -46, 38, -46, -46, -46, 50, -46, -46, 39,
22, 85, 59, -46, -46, -46, -46, 83, 84, 42,
104, -46, -46, -13, 47, -10, 105, 152, -46, -46,
-9, 61, 152, 152, -31, -46, -46, -46, 152, -46,
-46, 152, 152, -46, -46, -46, -46, -46, -46, 152,
152, 38, 152, -46, 109, 152, 110, -46, 152, 112,
120, 81, 137, 152, 135, 139, 130, -46, -46, 39,
-46, 22, -46, -13, 145, -46, 146, -46, 143, -46,
-46, -46, -46, 142, 152, -46, -46, 150, 136, 136,
-46, -46, -46, 152, 125, -46, 160, 136, 136, -46,
-46
};
/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
......@@ -854,39 +857,38 @@ static const yytype_int16 yypact[] =
means the default is an error. */
static const yytype_int8 yydefact[] =
{
0, 44, 0, 42, 43, 45, 89, 0, 5, 2,
3, 4, 0, 47, 0, 1, 6, 0, 0, 17,
0, 12, 46, 9, 0, 0, 10, 0, 0, 14,
15, 18, 0, 13, 9, 0, 8, 40, 0, 38,
11, 20, 7, 0, 16, 0, 0, 41, 38, 0,
0, 0, 51, 0, 58, 50, 53, 49, 64, 66,
68, 70, 72, 74, 39, 48, 19, 22, 0, 0,
0, 0, 23, 21, 0, 0, 48, 0, 48, 0,
62, 63, 0, 55, 0, 80, 81, 82, 0, 79,
78, 0, 0, 83, 84, 85, 86, 87, 88, 0,
0, 75, 0, 0, 0, 32, 0, 0, 0, 36,
0, 0, 0, 0, 60, 0, 0, 56, 65, 67,
71, 69, 73, 76, 0, 0, 0, 0, 31, 0,
24, 0, 0, 29, 30, 61, 0, 75, 75, 52,
59, 0, 0, 0, 25, 59, 54, 0, 77, 0,
33, 35, 0, 0, 0, 57, 0, 0, 0, 27,
28, 0, 34, 26, 37
0, 41, 0, 39, 40, 42, 85, 0, 5, 2,
3, 4, 0, 44, 0, 1, 6, 43, 0, 17,
0, 12, 9, 0, 0, 10, 0, 0, 14, 15,
18, 0, 13, 9, 0, 8, 37, 0, 35, 11,
20, 7, 0, 16, 0, 0, 38, 35, 0, 0,
0, 52, 0, 51, 53, 50, 56, 60, 62, 64,
66, 68, 70, 36, 45, 19, 22, 0, 0, 0,
0, 23, 21, 0, 0, 45, 0, 0, 58, 59,
0, 55, 71, 0, 0, 76, 77, 78, 0, 75,
74, 0, 0, 79, 80, 81, 82, 83, 84, 0,
0, 0, 0, 29, 0, 0, 0, 33, 0, 0,
0, 49, 0, 0, 72, 0, 0, 47, 61, 63,
67, 65, 69, 0, 0, 28, 0, 24, 0, 26,
27, 57, 49, 0, 71, 48, 46, 0, 0, 0,
25, 54, 73, 0, 30, 32, 0, 0, 0, 31,
34
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-89, -89, -89, 163, 170, -89, 164, -89, 176, -89,
-89, 174, -89, -88, -89, -33, 6, 14, -73, 119,
113, -89, 121, -44, -67, -89, -89, -89, 0
-46, -46, -46, 156, 154, -46, 133, -46, 162, -46,
-46, 153, -46, -45, -46, -35, 3, -46, 49, 101,
78, 91, -46, 102, -34, 69, -46, -46, -46, 0
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int8 yydefgoto[] =
{
-1, 7, 8, 9, 10, 26, 27, 11, 21, 31,
24, 72, 46, 73, 37, 38, 74, 58, 59, 60,
61, 62, 63, 75, 124, 91, 88, 99, 65
-1, 7, 8, 9, 10, 25, 26, 11, 21, 30,
23, 71, 45, 72, 36, 37, 73, 56, 57, 58,
59, 60, 61, 62, 74, 115, 91, 88, 99, 64
};
/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
......@@ -894,99 +896,88 @@ static const yytype_int8 yydefgoto[] =
number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
13, 64, 14, 17, 19, 77, 12, 23, 13, 101,
47, 6, 18, 45, 12, 118, 111, 15, 112, 113,
25, 89, 22, 13, 13, 90, 106, 19, 36, 28,
32, 20, 39, 152, 13, 77, 153, 154, 6, 23,
28, 108, 135, 48, 79, 101, 76, 109, 110, 78,
34, -47, 102, 83, 150, 151, 122, 123, 125, 82,
127, 101, 115, 129, 80, 81, 131, 132, 102, 162,
147, 148, 136, 164, 48, 52, 85, 86, 87, 53,
54, 41, 35, 55, 117, 43, 6, 56, 57, 29,
45, 44, 100, 123, 123, 103, 104, 49, 107, 84,
41, 66, 67, 13, 114, 156, 116, 1, 158, 126,
50, 51, 1, -47, 3, 128, 130, 133, 4, 3,
5, 134, 6, 4, 1, 5, 141, 6, 52, 68,
69, 3, 53, 54, 70, 4, 55, 5, 71, 6,
56, 57, 76, 76, 137, 49, 140, 139, 41, 138,
67, 142, 143, 144, 149, 1, 2, 76, 50, 51,
49, 76, 3, 145, 146, 105, 4, 155, 5, 157,
6, 16, 1, 50, 51, 159, 52, 68, 69, 3,
53, 54, 70, 4, 55, 5, 71, 6, 56, 57,
160, 52, 49, 163, 30, 53, 54, 161, 40, 55,
22, 33, 6, 56, 57, 50, 51, 49, 92, 42,
119, 0, 121, 120, 93, 94, 95, 96, 97, 98,
50, 51, 0, 52, 0, 0, 0, 53, 54, 0,
0, 55, 0, 0, 6, 56, 57, 0, 52, 0,
0, 0, 53, 54, 0, 0, 55, 0, 0, 6,
56, 57
13, 17, 14, 12, -44, 17, 113, 46, 13, 22,
63, 12, 18, 19, 76, 44, 6, 1, 2, 15,
24, 22, 13, 13, 3, 27, 31, 35, 4, 33,
5, 38, 6, 13, 6, 104, 27, -44, 106, 19,
89, 20, 47, 112, 90, 75, 48, 40, 114, 116,
34, 103, 81, 43, 82, 80, 107, 108, 109, 110,
49, 50, 85, 86, 87, 83, 122, 84, 124, 42,
1, 126, 44, 47, 128, -44, -44, 3, 51, 133,
100, 4, 52, 5, 117, 6, 53, 101, 102, 6,
54, 55, 48, 144, 145, 40, 65, 66, 78, 79,
114, 13, 149, 150, 123, 92, 49, 50, 105, 146,
111, 93, 94, 95, 96, 97, 98, 77, 125, 127,
1, 129, 131, 137, 51, 67, 68, 3, 52, 130,
69, 4, 53, 5, 70, 6, 54, 55, 75, 75,
48, 134, 132, 40, 135, 66, 136, 75, 75, 51,
138, 139, 140, 52, 49, 50, 48, 53, 141, 147,
6, 54, 55, 143, 16, 148, 39, 28, 1, 119,
49, 50, 51, 67, 68, 3, 52, 29, 69, 4,
53, 5, 70, 6, 54, 55, 32, 41, 51, 118,
121, 1, 52, 0, 120, 0, 53, 0, 3, 6,
54, 55, 4, 142, 5, 0, 6
};
static const yytype_int16 yycheck[] =
{
0, 45, 2, 11, 7, 49, 0, 4, 8, 4,
43, 46, 12, 10, 8, 88, 11, 0, 13, 14,
20, 17, 12, 23, 24, 21, 70, 7, 28, 23,
24, 34, 32, 10, 34, 79, 13, 14, 46, 4,
34, 74, 115, 43, 4, 4, 46, 9, 10, 49,
6, 46, 11, 53, 142, 143, 100, 101, 102, 53,
104, 4, 5, 107, 50, 51, 110, 111, 11, 157,
137, 138, 116, 161, 74, 35, 22, 23, 24, 39,
40, 7, 5, 43, 84, 6, 46, 47, 48, 8,
10, 9, 20, 137, 138, 4, 4, 4, 4, 16,
7, 8, 9, 103, 5, 149, 11, 31, 152, 103,
17, 18, 31, 11, 38, 9, 9, 9, 42, 38,
44, 9, 46, 42, 31, 44, 126, 46, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
47, 48, 142, 143, 4, 4, 12, 5, 7, 6,
9, 5, 5, 9, 15, 31, 32, 157, 17, 18,
4, 161, 38, 12, 12, 9, 42, 5, 44, 33,
46, 8, 31, 17, 18, 9, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
9, 35, 4, 9, 24, 39, 40, 5, 34, 43,
12, 25, 46, 47, 48, 17, 18, 4, 19, 35,
91, -1, 99, 92, 25, 26, 27, 28, 29, 30,
17, 18, -1, 35, -1, -1, -1, 39, 40, -1,
-1, 43, -1, -1, 46, 47, 48, -1, 35, -1,
-1, -1, 39, 40, -1, -1, 43, -1, -1, 46,
47, 48
0, 14, 2, 0, 14, 14, 15, 42, 8, 4,
44, 8, 12, 7, 48, 10, 47, 32, 33, 0,
20, 4, 22, 23, 39, 22, 23, 27, 43, 6,
45, 31, 47, 33, 47, 69, 33, 47, 73, 7,
18, 35, 42, 77, 22, 45, 4, 7, 82, 83,
5, 9, 52, 9, 4, 52, 9, 10, 11, 12,
18, 19, 23, 24, 25, 15, 100, 17, 102, 6,
32, 105, 10, 73, 108, 14, 15, 39, 36, 113,
21, 43, 40, 45, 84, 47, 44, 4, 4, 47,
48, 49, 4, 138, 139, 7, 8, 9, 49, 50,
134, 101, 147, 148, 101, 20, 18, 19, 4, 143,
5, 26, 27, 28, 29, 30, 31, 4, 9, 9,
32, 9, 41, 123, 36, 37, 38, 39, 40, 9,
42, 43, 44, 45, 46, 47, 48, 49, 138, 139,
4, 6, 5, 7, 5, 9, 16, 147, 148, 36,
5, 5, 9, 40, 18, 19, 4, 44, 16, 34,
47, 48, 49, 13, 8, 5, 33, 8, 32, 91,
18, 19, 36, 37, 38, 39, 40, 23, 42, 43,
44, 45, 46, 47, 48, 49, 24, 34, 36, 88,
99, 32, 40, -1, 92, -1, 44, -1, 39, 47,
48, 49, 43, 134, 45, -1, 47
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_int8 yystos[] =
{
0, 31, 32, 38, 42, 44, 46, 50, 51, 52,
53, 56, 65, 77, 77, 0, 52, 11, 77, 7,
34, 57, 12, 4, 59, 77, 54, 55, 65, 8,
53, 58, 65, 57, 6, 5, 77, 63, 64, 77,
55, 7, 60, 6, 9, 10, 61, 64, 77, 4,
17, 18, 35, 39, 40, 43, 47, 48, 66, 67,
68, 69, 70, 71, 72, 77, 8, 9, 36, 37,
41, 45, 60, 62, 65, 72, 77, 72, 77, 4,
66, 66, 65, 77, 16, 22, 23, 24, 75, 17,
21, 74, 19, 25, 26, 27, 28, 29, 30, 76,
20, 4, 11, 4, 4, 9, 72, 4, 64, 9,
10, 11, 13, 14, 5, 5, 11, 77, 67, 68,
71, 69, 72, 72, 73, 72, 65, 72, 9, 72,
9, 72, 72, 9, 9, 67, 72, 4, 6, 5,
12, 77, 5, 5, 9, 12, 12, 73, 73, 15,
62, 62, 10, 13, 14, 5, 72, 33, 72, 9,
9, 5, 62, 9, 62
0, 32, 33, 39, 43, 45, 47, 51, 52, 53,
54, 57, 66, 79, 79, 0, 53, 14, 79, 7,
35, 58, 4, 60, 79, 55, 56, 66, 8, 54,
59, 66, 58, 6, 5, 79, 64, 65, 79, 56,
7, 61, 6, 9, 10, 62, 65, 79, 4, 18,
19, 36, 40, 44, 48, 49, 67, 68, 69, 70,
71, 72, 73, 74, 79, 8, 9, 37, 38, 42,
46, 61, 63, 66, 74, 79, 74, 4, 68, 68,
66, 79, 4, 15, 17, 23, 24, 25, 77, 18,
22, 76, 20, 26, 27, 28, 29, 30, 31, 78,
21, 4, 4, 9, 74, 4, 65, 9, 10, 11,
12, 5, 74, 15, 74, 75, 74, 79, 69, 70,
73, 71, 74, 66, 74, 9, 74, 9, 74, 9,
9, 41, 5, 74, 6, 5, 16, 79, 5, 5,
9, 16, 75, 13, 63, 63, 74, 34, 5, 63,
63
};
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_int8 yyr1[] =
{
0, 49, 50, 51, 51, 52, 52, 53, 54, 55,
55, 55, 56, 56, 57, 58, 58, 59, 59, 60,
61, 61, 62, 62, 62, 62, 62, 62, 62, 62,
62, 62, 62, 62, 62, 62, 62, 62, 63, 63,
64, 64, 65, 65, 65, 65, 65, 65, 66, 66,
66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
66, 67, 67, 67, 67, 68, 68, 69, 69, 70,
70, 71, 71, 72, 72, 73, 73, 73, 74, 74,
75, 75, 75, 76, 76, 76, 76, 76, 76, 77
0, 50, 51, 52, 52, 53, 53, 54, 55, 56,
56, 56, 57, 57, 58, 59, 59, 60, 60, 61,
62, 62, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 64, 64, 65, 65, 66,
66, 66, 66, 66, 66, 67, 67, 67, 67, 67,
68, 68, 68, 68, 68, 68, 68, 69, 69, 69,
69, 70, 70, 71, 71, 72, 72, 73, 73, 74,
74, 75, 75, 75, 76, 76, 77, 77, 77, 78,
78, 78, 78, 78, 78, 79
};
/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
......@@ -994,13 +985,13 @@ static const yytype_int8 yyr2[] =
{
0, 2, 1, 1, 1, 1, 2, 6, 2, 0,
1, 3, 3, 5, 3, 1, 3, 0, 2, 3,
0, 2, 1, 1, 3, 4, 7, 6, 6, 3,
3, 3, 2, 5, 7, 5, 2, 8, 1, 3,
1, 3, 1, 1, 1, 1, 3, 1, 1, 1,
1, 1, 4, 1, 5, 2, 3, 6, 1, 4,
3, 4, 2, 2, 1, 3, 1, 3, 1, 3,
1, 3, 1, 3, 1, 0, 1, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1
0, 2, 1, 1, 3, 4, 3, 3, 3, 2,
5, 7, 5, 2, 8, 1, 3, 1, 3, 1,
1, 1, 1, 2, 1, 1, 4, 3, 4, 3,
1, 1, 1, 1, 5, 2, 1, 4, 2, 2,
1, 3, 1, 3, 1, 3, 1, 3, 1, 3,
1, 0, 1, 3, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1
};
......@@ -1468,535 +1459,511 @@ yyreduce:
switch (yyn)
{
case 2: /* Program: ListTopDef */
#line 210 "Grammar.y"
#line 212 "Grammar.y"
{ std::reverse((yyvsp[0].listtopdef_)->begin(),(yyvsp[0].listtopdef_)->end()) ;(yyval.program_) = new Prog((yyvsp[0].listtopdef_)); YY_RESULT_Program_= (yyval.program_); }
#line 1474 "Parser.cpp"
#line 1465 "Parser.cpp"
break;
case 3: /* TopDef: FunDef */
#line 212 "Grammar.y"
#line 214 "Grammar.y"
{ (yyval.topdef_) = new FnDef((yyvsp[0].fundef_)); }
#line 1480 "Parser.cpp"
#line 1471 "Parser.cpp"
break;
case 4: /* TopDef: ClassDef */
#line 213 "Grammar.y"
#line 215 "Grammar.y"
{ (yyval.topdef_) = new ClDef((yyvsp[0].classdef_)); }
#line 1486 "Parser.cpp"
#line 1477 "Parser.cpp"
break;
case 5: /* ListTopDef: TopDef */
#line 215 "Grammar.y"
#line 217 "Grammar.y"
{ (yyval.listtopdef_) = new ListTopDef() ; (yyval.listtopdef_)->push_back((yyvsp[0].topdef_)); }
#line 1492 "Parser.cpp"
#line 1483 "Parser.cpp"
break;
case 6: /* ListTopDef: TopDef ListTopDef */
#line 216 "Grammar.y"
#line 218 "Grammar.y"
{ (yyvsp[0].listtopdef_)->push_back((yyvsp[-1].topdef_)) ; (yyval.listtopdef_) = (yyvsp[0].listtopdef_) ; }
#line 1498 "Parser.cpp"
#line 1489 "Parser.cpp"
break;
case 7: /* FunDef: Type PIdent _SYMB_0 ListArg _SYMB_1 Block */
#line 218 "Grammar.y"
#line 220 "Grammar.y"
{ std::reverse((yyvsp[-2].listarg_)->begin(),(yyvsp[-2].listarg_)->end()) ;(yyval.fundef_) = new FuncDef((yyvsp[-5].type_), (yyvsp[-4].pident_), (yyvsp[-2].listarg_), (yyvsp[0].block_)); }
#line 1504 "Parser.cpp"
#line 1495 "Parser.cpp"
break;
case 8: /* Arg: Type PIdent */
#line 220 "Grammar.y"
#line 222 "Grammar.y"
{ (yyval.arg_) = new Ar((yyvsp[-1].type_), (yyvsp[0].pident_)); }
#line 1510 "Parser.cpp"
#line 1501 "Parser.cpp"
break;
case 9: /* ListArg: %empty */
#line 222 "Grammar.y"
#line 224 "Grammar.y"
{ (yyval.listarg_) = new ListArg(); }
#line 1516 "Parser.cpp"
#line 1507 "Parser.cpp"
break;
case 10: /* ListArg: Arg */
#line 223 "Grammar.y"
#line 225 "Grammar.y"
{ (yyval.listarg_) = new ListArg() ; (yyval.listarg_)->push_back((yyvsp[0].arg_)); }
#line 1522 "Parser.cpp"
#line 1513 "Parser.cpp"
break;
case 11: /* ListArg: Arg _SYMB_2 ListArg */
#line 224 "Grammar.y"
#line 226 "Grammar.y"
{ (yyvsp[0].listarg_)->push_back((yyvsp[-2].arg_)) ; (yyval.listarg_) = (yyvsp[0].listarg_) ; }
#line 1528 "Parser.cpp"
#line 1519 "Parser.cpp"
break;
case 12: /* ClassDef: _SYMB_28 PIdent ClassBlock */
#line 226 "Grammar.y"
case 12: /* ClassDef: _SYMB_29 PIdent ClassBlock */
#line 228 "Grammar.y"
{ (yyval.classdef_) = new ClassDefN((yyvsp[-1].pident_), (yyvsp[0].classblock_)); }
#line 1534 "Parser.cpp"
#line 1525 "Parser.cpp"
break;
case 13: /* ClassDef: _SYMB_28 PIdent _SYMB_30 PIdent ClassBlock */
#line 227 "Grammar.y"
case 13: /* ClassDef: _SYMB_29 PIdent _SYMB_31 PIdent ClassBlock */
#line 229 "Grammar.y"
{ (yyval.classdef_) = new ClassDefE((yyvsp[-3].pident_), (yyvsp[-1].pident_), (yyvsp[0].classblock_)); }
#line 1540 "Parser.cpp"
#line 1531 "Parser.cpp"
break;
case 14: /* ClassBlock: _SYMB_3 ListClassBlockDef _SYMB_4 */
#line 229 "Grammar.y"
#line 231 "Grammar.y"
{ (yyval.classblock_) = new ClassBl((yyvsp[-1].listclassblockdef_)); }
#line 1546 "Parser.cpp"
#line 1537 "Parser.cpp"
break;
case 15: /* ClassBlockDef: FunDef */
#line 231 "Grammar.y"
#line 233 "Grammar.y"
{ (yyval.classblockdef_) = new ClassMthd((yyvsp[0].fundef_)); }
#line 1552 "Parser.cpp"
#line 1543 "Parser.cpp"
break;
case 16: /* ClassBlockDef: Type ListItem _SYMB_5 */
#line 232 "Grammar.y"
#line 234 "Grammar.y"
{ std::reverse((yyvsp[-1].listitem_)->begin(),(yyvsp[-1].listitem_)->end()) ;(yyval.classblockdef_) = new ClassFld((yyvsp[-2].type_), (yyvsp[-1].listitem_)); }
#line 1558 "Parser.cpp"
#line 1549 "Parser.cpp"
break;
case 17: /* ListClassBlockDef: %empty */
#line 234 "Grammar.y"
#line 236 "Grammar.y"
{ (yyval.listclassblockdef_) = new ListClassBlockDef(); }
#line 1564 "Parser.cpp"
#line 1555 "Parser.cpp"
break;
case 18: /* ListClassBlockDef: ListClassBlockDef ClassBlockDef */
#line 235 "Grammar.y"
#line 237 "Grammar.y"
{ (yyvsp[-1].listclassblockdef_)->push_back((yyvsp[0].classblockdef_)) ; (yyval.listclassblockdef_) = (yyvsp[-1].listclassblockdef_) ; }
#line 1570 "Parser.cpp"
#line 1561 "Parser.cpp"
break;
case 19: /* Block: _SYMB_3 ListStmt _SYMB_4 */
#line 237 "Grammar.y"
#line 239 "Grammar.y"
{ (yyval.block_) = new Blk((yyvsp[-1].liststmt_)); }
#line 1576 "Parser.cpp"
#line 1567 "Parser.cpp"
break;
case 20: /* ListStmt: %empty */
#line 239 "Grammar.y"
#line 241 "Grammar.y"
{ (yyval.liststmt_) = new ListStmt(); }
#line 1582 "Parser.cpp"
#line 1573 "Parser.cpp"
break;
case 21: /* ListStmt: ListStmt Stmt */
#line 240 "Grammar.y"
#line 242 "Grammar.y"
{ (yyvsp[-1].liststmt_)->push_back((yyvsp[0].stmt_)) ; (yyval.liststmt_) = (yyvsp[-1].liststmt_) ; }
#line 1588 "Parser.cpp"
#line 1579 "Parser.cpp"
break;
case 22: /* Stmt: _SYMB_5 */
#line 242 "Grammar.y"
#line 244 "Grammar.y"
{ (yyval.stmt_) = new Empty(); }
#line 1594 "Parser.cpp"
#line 1585 "Parser.cpp"
break;
case 23: /* Stmt: Block */
#line 243 "Grammar.y"
#line 245 "Grammar.y"
{ (yyval.stmt_) = new BStmt((yyvsp[0].block_)); }
#line 1600 "Parser.cpp"
#line 1591 "Parser.cpp"
break;
case 24: /* Stmt: Type ListItem _SYMB_5 */
#line 244 "Grammar.y"
#line 246 "Grammar.y"
{ std::reverse((yyvsp[-1].listitem_)->begin(),(yyvsp[-1].listitem_)->end()) ;(yyval.stmt_) = new Decl((yyvsp[-2].type_), (yyvsp[-1].listitem_)); }
#line 1606 "Parser.cpp"
#line 1597 "Parser.cpp"
break;
case 25: /* Stmt: Expr _SYMB_6 Expr _SYMB_5 */
#line 245 "Grammar.y"
{ (yyval.stmt_) = new Ass((yyvsp[-3].expr_), (yyvsp[-1].expr_)); }
#line 1612 "Parser.cpp"
break;
case 26: /* Stmt: PIdent _SYMB_7 Expr _SYMB_8 _SYMB_6 Expr _SYMB_5 */
#line 246 "Grammar.y"
{ (yyval.stmt_) = new TableAss((yyvsp[-6].pident_), (yyvsp[-4].expr_), (yyvsp[-1].expr_)); }
#line 1618 "Parser.cpp"
break;
case 27: /* Stmt: PIdent _SYMB_7 Expr _SYMB_8 _SYMB_9 _SYMB_5 */
#line 247 "Grammar.y"
{ (yyval.stmt_) = new TableIncr((yyvsp[-5].pident_), (yyvsp[-3].expr_)); }
#line 1624 "Parser.cpp"
{ (yyval.stmt_) = new Ass((yyvsp[-3].expr_), (yyvsp[-1].expr_)); }
#line 1603 "Parser.cpp"
break;
case 28: /* Stmt: PIdent _SYMB_7 Expr _SYMB_8 _SYMB_10 _SYMB_5 */
case 26: /* Stmt: Expr _SYMB_7 _SYMB_5 */
#line 248 "Grammar.y"
{ (yyval.stmt_) = new TableDecr((yyvsp[-5].pident_), (yyvsp[-3].expr_)); }
#line 1630 "Parser.cpp"
{ (yyval.stmt_) = new Incr((yyvsp[-2].expr_)); }
#line 1609 "Parser.cpp"
break;
case 29: /* Stmt: PIdent _SYMB_9 _SYMB_5 */
case 27: /* Stmt: Expr _SYMB_8 _SYMB_5 */
#line 249 "Grammar.y"
{ (yyval.stmt_) = new Incr((yyvsp[-2].pident_)); }
#line 1636 "Parser.cpp"
{ (yyval.stmt_) = new Decr((yyvsp[-2].expr_)); }
#line 1615 "Parser.cpp"
break;
case 30: /* Stmt: PIdent _SYMB_10 _SYMB_5 */
case 28: /* Stmt: _SYMB_38 Expr _SYMB_5 */
#line 250 "Grammar.y"
{ (yyval.stmt_) = new Decr((yyvsp[-2].pident_)); }
#line 1642 "Parser.cpp"
break;
case 31: /* Stmt: _SYMB_37 Expr _SYMB_5 */
#line 251 "Grammar.y"
{ (yyval.stmt_) = new Ret((yyvsp[-1].expr_)); }
#line 1648 "Parser.cpp"
#line 1621 "Parser.cpp"
break;
case 32: /* Stmt: _SYMB_37 _SYMB_5 */
#line 252 "Grammar.y"
case 29: /* Stmt: _SYMB_38 _SYMB_5 */
#line 251 "Grammar.y"
{ (yyval.stmt_) = new VRet(); }
#line 1654 "Parser.cpp"
#line 1627 "Parser.cpp"
break;
case 33: /* Stmt: _SYMB_33 _SYMB_0 Expr _SYMB_1 Stmt */
#line 253 "Grammar.y"
case 30: /* Stmt: _SYMB_34 _SYMB_0 Expr _SYMB_1 Stmt */
#line 252 "Grammar.y"
{ (yyval.stmt_) = new Cond((yyvsp[-2].expr_), (yyvsp[0].stmt_)); }
#line 1660 "Parser.cpp"
#line 1633 "Parser.cpp"
break;
case 34: /* Stmt: _SYMB_33 _SYMB_0 Expr _SYMB_1 Stmt _SYMB_29 Stmt */
#line 254 "Grammar.y"
case 31: /* Stmt: _SYMB_34 _SYMB_0 Expr _SYMB_1 Stmt _SYMB_30 Stmt */
#line 253 "Grammar.y"
{ (yyval.stmt_) = new CondElse((yyvsp[-4].expr_), (yyvsp[-2].stmt_), (yyvsp[0].stmt_)); }
#line 1666 "Parser.cpp"
#line 1639 "Parser.cpp"
break;
case 35: /* Stmt: _SYMB_41 _SYMB_0 Expr _SYMB_1 Stmt */
#line 255 "Grammar.y"
case 32: /* Stmt: _SYMB_42 _SYMB_0 Expr _SYMB_1 Stmt */
#line 254 "Grammar.y"
{ (yyval.stmt_) = new While((yyvsp[-2].expr_), (yyvsp[0].stmt_)); }
#line 1672 "Parser.cpp"
#line 1645 "Parser.cpp"
break;
case 36: /* Stmt: Expr _SYMB_5 */
#line 256 "Grammar.y"
case 33: /* Stmt: Expr _SYMB_5 */
#line 255 "Grammar.y"
{ (yyval.stmt_) = new SExp((yyvsp[-1].expr_)); }
#line 1678 "Parser.cpp"
#line 1651 "Parser.cpp"
break;
case 37: /* Stmt: _SYMB_32 _SYMB_0 Type PIdent _SYMB_11 Expr _SYMB_1 Stmt */
#line 257 "Grammar.y"
{ (yyval.stmt_) = new ForEach((yyvsp[-5].type_), (yyvsp[-4].pident_), (yyvsp[-2].expr_), (yyvsp[0].stmt_)); }
#line 1684 "Parser.cpp"
case 34: /* Stmt: _SYMB_33 _SYMB_0 Type PIdent _SYMB_9 Expr _SYMB_1 Stmt */
#line 256 "Grammar.y"
{ (yyval.stmt_) = new ForEach((yyvsp[-5].type_), (yyvsp[-4].pident_), (yyvsp[-2].expr_), (yyvsp[0].stmt_)); }
#line 1657 "Parser.cpp"
break;
case 38: /* Item: PIdent */
#line 259 "Grammar.y"
case 35: /* Item: PIdent */
#line 258 "Grammar.y"
{ (yyval.item_) = new NoInit((yyvsp[0].pident_)); }
#line 1690 "Parser.cpp"
#line 1663 "Parser.cpp"
break;
case 39: /* Item: PIdent _SYMB_6 Expr */
#line 260 "Grammar.y"
case 36: /* Item: PIdent _SYMB_6 Expr */
#line 259 "Grammar.y"
{ (yyval.item_) = new Init((yyvsp[-2].pident_), (yyvsp[0].expr_)); }
#line 1696 "Parser.cpp"
#line 1669 "Parser.cpp"
break;
case 40: /* ListItem: Item */
#line 262 "Grammar.y"
case 37: /* ListItem: Item */
#line 261 "Grammar.y"
{ (yyval.listitem_) = new ListItem() ; (yyval.listitem_)->push_back((yyvsp[0].item_)); }
#line 1702 "Parser.cpp"
#line 1675 "Parser.cpp"
break;
case 41: /* ListItem: Item _SYMB_2 ListItem */
#line 263 "Grammar.y"
case 38: /* ListItem: Item _SYMB_2 ListItem */
#line 262 "Grammar.y"
{ (yyvsp[0].listitem_)->push_back((yyvsp[-2].item_)) ; (yyval.listitem_) = (yyvsp[0].listitem_) ; }
#line 1708 "Parser.cpp"
#line 1681 "Parser.cpp"
break;
case 42: /* Type: _SYMB_34 */
#line 265 "Grammar.y"
case 39: /* Type: _SYMB_35 */
#line 264 "Grammar.y"
{ (yyval.type_) = new Int(); }
#line 1714 "Parser.cpp"
#line 1687 "Parser.cpp"
break;
case 43: /* Type: _SYMB_38 */
#line 266 "Grammar.y"
case 40: /* Type: _SYMB_39 */
#line 265 "Grammar.y"
{ (yyval.type_) = new Str(); }
#line 1720 "Parser.cpp"
#line 1693 "Parser.cpp"
break;
case 44: /* Type: _SYMB_27 */
#line 267 "Grammar.y"
case 41: /* Type: _SYMB_28 */
#line 266 "Grammar.y"
{ (yyval.type_) = new Bool(); }
#line 1726 "Parser.cpp"
#line 1699 "Parser.cpp"
break;
case 45: /* Type: _SYMB_40 */
#line 268 "Grammar.y"
case 42: /* Type: _SYMB_41 */
#line 267 "Grammar.y"
{ (yyval.type_) = new Void(); }
#line 1732 "Parser.cpp"
#line 1705 "Parser.cpp"
break;
case 46: /* Type: Type _SYMB_7 _SYMB_8 */
#line 269 "Grammar.y"
{ (yyval.type_) = new Array((yyvsp[-2].type_)); }
#line 1738 "Parser.cpp"
case 43: /* Type: Type _SYMB_10 */
#line 268 "Grammar.y"
{ (yyval.type_) = new Array((yyvsp[-1].type_)); }
#line 1711 "Parser.cpp"
break;
case 47: /* Type: PIdent */
#line 270 "Grammar.y"
case 44: /* Type: PIdent */
#line 269 "Grammar.y"
{ (yyval.type_) = new ClassT((yyvsp[0].pident_)); }
#line 1744 "Parser.cpp"
#line 1717 "Parser.cpp"
break;
case 48: /* Expr6: PIdent */
#line 276 "Grammar.y"
case 45: /* Expr7: PIdent */
#line 275 "Grammar.y"
{ (yyval.expr_) = new EVar((yyvsp[0].pident_)); }
#line 1750 "Parser.cpp"
#line 1723 "Parser.cpp"
break;
case 46: /* Expr7: Expr7 _SYMB_11 Expr _SYMB_12 */
#line 276 "Grammar.y"
{ (yyval.expr_) = new EIndexAcc((yyvsp[-3].expr_), (yyvsp[-1].expr_)); }
#line 1729 "Parser.cpp"
break;
case 49: /* Expr6: _INTEGER_ */
case 47: /* Expr7: Expr7 _SYMB_13 PIdent */
#line 277 "Grammar.y"
{ (yyval.expr_) = new ELitInt((yyvsp[0].int_)); }
#line 1756 "Parser.cpp"
{ (yyval.expr_) = new EClsMmbr((yyvsp[-2].expr_), (yyvsp[0].pident_)); }
#line 1735 "Parser.cpp"
break;
case 50: /* Expr6: _SYMB_39 */
case 48: /* Expr7: Expr7 _SYMB_0 ListExpr _SYMB_1 */
#line 278 "Grammar.y"
{ (yyval.expr_) = new ELitTrue(); }
#line 1762 "Parser.cpp"
{ std::reverse((yyvsp[-1].listexpr_)->begin(),(yyvsp[-1].listexpr_)->end()) ;(yyval.expr_) = new EApp((yyvsp[-3].expr_), (yyvsp[-1].listexpr_)); }
#line 1741 "Parser.cpp"
break;
case 51: /* Expr6: _SYMB_31 */
case 49: /* Expr7: _SYMB_0 Expr _SYMB_1 */
#line 279 "Grammar.y"
{ (yyval.expr_) = new ELitFalse(); }
#line 1768 "Parser.cpp"
break;
case 52: /* Expr6: PIdent _SYMB_0 ListExpr _SYMB_1 */
#line 280 "Grammar.y"
{ std::reverse((yyvsp[-1].listexpr_)->begin(),(yyvsp[-1].listexpr_)->end()) ;(yyval.expr_) = new EApp((yyvsp[-3].pident_), (yyvsp[-1].listexpr_)); }
#line 1774 "Parser.cpp"
{ (yyval.expr_) = (yyvsp[-1].expr_); }
#line 1747 "Parser.cpp"
break;
case 53: /* Expr6: _STRING_ */
case 50: /* Expr6: _INTEGER_ */
#line 281 "Grammar.y"
{ (yyval.expr_) = new EString((yyvsp[0].string_)); }
#line 1780 "Parser.cpp"
{ (yyval.expr_) = new ELitInt((yyvsp[0].int_)); }
#line 1753 "Parser.cpp"
break;
case 54: /* Expr6: _SYMB_35 Type _SYMB_7 Expr _SYMB_8 */
case 51: /* Expr6: _SYMB_40 */
#line 282 "Grammar.y"
{ (yyval.expr_) = new ENewArray((yyvsp[-3].type_), (yyvsp[-1].expr_)); }
#line 1786 "Parser.cpp"
{ (yyval.expr_) = new ELitTrue(); }
#line 1759 "Parser.cpp"
break;
case 55: /* Expr6: _SYMB_35 PIdent */
case 52: /* Expr6: _SYMB_32 */
#line 283 "Grammar.y"
{ (yyval.expr_) = new ENewClass((yyvsp[0].pident_)); }
#line 1792 "Parser.cpp"
{ (yyval.expr_) = new ELitFalse(); }
#line 1765 "Parser.cpp"
break;
case 56: /* Expr6: Expr6 _SYMB_12 PIdent */
case 53: /* Expr6: _STRING_ */
#line 284 "Grammar.y"
{ (yyval.expr_) = new EClsMmbr((yyvsp[-2].expr_), (yyvsp[0].pident_)); }
#line 1798 "Parser.cpp"
{ (yyval.expr_) = new EString((yyvsp[0].string_)); }
#line 1771 "Parser.cpp"
break;
case 57: /* Expr6: Expr6 _SYMB_12 PIdent _SYMB_0 ListExpr _SYMB_1 */
case 54: /* Expr6: _SYMB_36 Type _SYMB_11 Expr _SYMB_12 */
#line 285 "Grammar.y"
{ std::reverse((yyvsp[-1].listexpr_)->begin(),(yyvsp[-1].listexpr_)->end()) ;(yyval.expr_) = new EClsMthd((yyvsp[-5].expr_), (yyvsp[-3].pident_), (yyvsp[-1].listexpr_)); }
#line 1804 "Parser.cpp"
{ (yyval.expr_) = new ENewArray((yyvsp[-3].type_), (yyvsp[-1].expr_)); }
#line 1777 "Parser.cpp"
break;
case 58: /* Expr6: _SYMB_36 */
case 55: /* Expr6: _SYMB_36 PIdent */
#line 286 "Grammar.y"
{ (yyval.expr_) = new Null(); }
#line 1810 "Parser.cpp"
{ (yyval.expr_) = new ENewClass((yyvsp[0].pident_)); }
#line 1783 "Parser.cpp"
break;
case 59: /* Expr6: PIdent _SYMB_7 Expr _SYMB_8 */
case 56: /* Expr6: Expr7 */
#line 287 "Grammar.y"
{ (yyval.expr_) = new EIndexAcc((yyvsp[-3].pident_), (yyvsp[-1].expr_)); }
#line 1816 "Parser.cpp"
{ (yyval.expr_) = (yyvsp[0].expr_); }
#line 1789 "Parser.cpp"
break;
case 60: /* Expr6: _SYMB_0 Expr _SYMB_1 */
#line 288 "Grammar.y"
{ (yyval.expr_) = (yyvsp[-1].expr_); }
#line 1822 "Parser.cpp"
case 57: /* Expr5: _SYMB_0 Expr _SYMB_1 _SYMB_37 */
#line 289 "Grammar.y"
{ (yyval.expr_) = new NullCast((yyvsp[-2].expr_)); }
#line 1795 "Parser.cpp"
break;
case 61: /* Expr5: _SYMB_0 PIdent _SYMB_1 Expr5 */
case 58: /* Expr5: _SYMB_14 Expr6 */
#line 290 "Grammar.y"
{ (yyval.expr_) = new ECast((yyvsp[-2].pident_), (yyvsp[0].expr_)); }
#line 1828 "Parser.cpp"
break;
case 62: /* Expr5: _SYMB_13 Expr6 */
#line 291 "Grammar.y"
{ (yyval.expr_) = new Neg((yyvsp[0].expr_)); }
#line 1834 "Parser.cpp"
#line 1801 "Parser.cpp"
break;
case 63: /* Expr5: _SYMB_14 Expr6 */
#line 292 "Grammar.y"
case 59: /* Expr5: _SYMB_15 Expr6 */
#line 291 "Grammar.y"
{ (yyval.expr_) = new Not((yyvsp[0].expr_)); }
#line 1840 "Parser.cpp"
#line 1807 "Parser.cpp"
break;
case 64: /* Expr5: Expr6 */
#line 293 "Grammar.y"
case 60: /* Expr5: Expr6 */
#line 292 "Grammar.y"
{ (yyval.expr_) = (yyvsp[0].expr_); }
#line 1846 "Parser.cpp"
#line 1813 "Parser.cpp"
break;
case 65: /* Expr4: Expr4 MulOp Expr5 */
#line 295 "Grammar.y"
case 61: /* Expr4: Expr4 MulOp Expr5 */
#line 294 "Grammar.y"
{ (yyval.expr_) = new EMul((yyvsp[-2].expr_), (yyvsp[-1].mulop_), (yyvsp[0].expr_)); }
#line 1852 "Parser.cpp"
#line 1819 "Parser.cpp"
break;
case 66: /* Expr4: Expr5 */
#line 296 "Grammar.y"
case 62: /* Expr4: Expr5 */
#line 295 "Grammar.y"
{ (yyval.expr_) = (yyvsp[0].expr_); }
#line 1858 "Parser.cpp"
#line 1825 "Parser.cpp"
break;
case 67: /* Expr3: Expr3 AddOp Expr4 */
#line 298 "Grammar.y"
case 63: /* Expr3: Expr3 AddOp Expr4 */
#line 297 "Grammar.y"
{ (yyval.expr_) = new EAdd((yyvsp[-2].expr_), (yyvsp[-1].addop_), (yyvsp[0].expr_)); }
#line 1864 "Parser.cpp"
#line 1831 "Parser.cpp"
break;
case 68: /* Expr3: Expr4 */
#line 299 "Grammar.y"
case 64: /* Expr3: Expr4 */
#line 298 "Grammar.y"
{ (yyval.expr_) = (yyvsp[0].expr_); }
#line 1870 "Parser.cpp"
#line 1837 "Parser.cpp"
break;
case 69: /* Expr2: Expr2 RelOp Expr3 */
#line 301 "Grammar.y"
case 65: /* Expr2: Expr2 RelOp Expr3 */
#line 300 "Grammar.y"
{ (yyval.expr_) = new ERel((yyvsp[-2].expr_), (yyvsp[-1].relop_), (yyvsp[0].expr_)); }
#line 1876 "Parser.cpp"
#line 1843 "Parser.cpp"
break;
case 70: /* Expr2: Expr3 */
#line 302 "Grammar.y"
case 66: /* Expr2: Expr3 */
#line 301 "Grammar.y"
{ (yyval.expr_) = (yyvsp[0].expr_); }
#line 1882 "Parser.cpp"
#line 1849 "Parser.cpp"
break;
case 71: /* Expr1: Expr2 _SYMB_15 Expr1 */
#line 304 "Grammar.y"
case 67: /* Expr1: Expr2 _SYMB_16 Expr1 */
#line 303 "Grammar.y"
{ (yyval.expr_) = new EAnd((yyvsp[-2].expr_), (yyvsp[0].expr_)); }
#line 1888 "Parser.cpp"
#line 1855 "Parser.cpp"
break;
case 72: /* Expr1: Expr2 */
#line 305 "Grammar.y"
case 68: /* Expr1: Expr2 */
#line 304 "Grammar.y"
{ (yyval.expr_) = (yyvsp[0].expr_); }
#line 1894 "Parser.cpp"
#line 1861 "Parser.cpp"
break;
case 73: /* Expr: Expr1 _SYMB_16 Expr */
#line 307 "Grammar.y"
case 69: /* Expr: Expr1 _SYMB_17 Expr */
#line 306 "Grammar.y"
{ (yyval.expr_) = new EOr((yyvsp[-2].expr_), (yyvsp[0].expr_)); }
#line 1900 "Parser.cpp"
#line 1867 "Parser.cpp"
break;
case 74: /* Expr: Expr1 */
#line 308 "Grammar.y"
case 70: /* Expr: Expr1 */
#line 307 "Grammar.y"
{ (yyval.expr_) = (yyvsp[0].expr_); }
#line 1906 "Parser.cpp"
#line 1873 "Parser.cpp"
break;
case 75: /* ListExpr: %empty */
#line 310 "Grammar.y"
case 71: /* ListExpr: %empty */
#line 309 "Grammar.y"
{ (yyval.listexpr_) = new ListExpr(); }
#line 1912 "Parser.cpp"
#line 1879 "Parser.cpp"
break;
case 76: /* ListExpr: Expr */
#line 311 "Grammar.y"
case 72: /* ListExpr: Expr */
#line 310 "Grammar.y"
{ (yyval.listexpr_) = new ListExpr() ; (yyval.listexpr_)->push_back((yyvsp[0].expr_)); }
#line 1918 "Parser.cpp"
#line 1885 "Parser.cpp"
break;
case 77: /* ListExpr: Expr _SYMB_2 ListExpr */
#line 312 "Grammar.y"
case 73: /* ListExpr: Expr _SYMB_2 ListExpr */
#line 311 "Grammar.y"
{ (yyvsp[0].listexpr_)->push_back((yyvsp[-2].expr_)) ; (yyval.listexpr_) = (yyvsp[0].listexpr_) ; }
#line 1924 "Parser.cpp"
#line 1891 "Parser.cpp"
break;
case 78: /* AddOp: _SYMB_17 */
#line 314 "Grammar.y"
case 74: /* AddOp: _SYMB_18 */
#line 313 "Grammar.y"
{ (yyval.addop_) = new Plus(); }
#line 1930 "Parser.cpp"
#line 1897 "Parser.cpp"
break;
case 79: /* AddOp: _SYMB_13 */
#line 315 "Grammar.y"
case 75: /* AddOp: _SYMB_14 */
#line 314 "Grammar.y"
{ (yyval.addop_) = new Minus(); }
#line 1936 "Parser.cpp"
#line 1903 "Parser.cpp"
break;
case 80: /* MulOp: _SYMB_18 */
#line 317 "Grammar.y"
case 76: /* MulOp: _SYMB_19 */
#line 316 "Grammar.y"
{ (yyval.mulop_) = new Times(); }
#line 1942 "Parser.cpp"
#line 1909 "Parser.cpp"
break;
case 81: /* MulOp: _SYMB_19 */
#line 318 "Grammar.y"
case 77: /* MulOp: _SYMB_20 */
#line 317 "Grammar.y"
{ (yyval.mulop_) = new Div(); }
#line 1948 "Parser.cpp"
#line 1915 "Parser.cpp"
break;
case 82: /* MulOp: _SYMB_20 */
#line 319 "Grammar.y"
case 78: /* MulOp: _SYMB_21 */
#line 318 "Grammar.y"
{ (yyval.mulop_) = new Mod(); }
#line 1954 "Parser.cpp"
#line 1921 "Parser.cpp"
break;
case 83: /* RelOp: _SYMB_21 */
#line 321 "Grammar.y"
case 79: /* RelOp: _SYMB_22 */
#line 320 "Grammar.y"
{ (yyval.relop_) = new LTH(); }
#line 1960 "Parser.cpp"
#line 1927 "Parser.cpp"
break;
case 84: /* RelOp: _SYMB_22 */
#line 322 "Grammar.y"
case 80: /* RelOp: _SYMB_23 */
#line 321 "Grammar.y"
{ (yyval.relop_) = new LE(); }
#line 1966 "Parser.cpp"
#line 1933 "Parser.cpp"
break;
case 85: /* RelOp: _SYMB_23 */
#line 323 "Grammar.y"
case 81: /* RelOp: _SYMB_24 */
#line 322 "Grammar.y"
{ (yyval.relop_) = new GTH(); }
#line 1972 "Parser.cpp"
#line 1939 "Parser.cpp"
break;
case 86: /* RelOp: _SYMB_24 */
#line 324 "Grammar.y"
case 82: /* RelOp: _SYMB_25 */
#line 323 "Grammar.y"
{ (yyval.relop_) = new GE(); }
#line 1978 "Parser.cpp"
#line 1945 "Parser.cpp"
break;
case 87: /* RelOp: _SYMB_25 */
#line 325 "Grammar.y"
case 83: /* RelOp: _SYMB_26 */
#line 324 "Grammar.y"
{ (yyval.relop_) = new EQU(); }
#line 1984 "Parser.cpp"
#line 1951 "Parser.cpp"
break;
case 88: /* RelOp: _SYMB_26 */
#line 326 "Grammar.y"
case 84: /* RelOp: _SYMB_27 */
#line 325 "Grammar.y"
{ (yyval.relop_) = new NE(); }
#line 1990 "Parser.cpp"
#line 1957 "Parser.cpp"
break;
case 89: /* PIdent: _SYMB_42 */
#line 328 "Grammar.y"
case 85: /* PIdent: _SYMB_43 */
#line 327 "Grammar.y"
{ (yyval.pident_) = new PIdent((yyvsp[0].string_),yy_mylinenumber) ; YY_RESULT_PIdent_= (yyval.pident_) ; }
#line 1996 "Parser.cpp"
#line 1963 "Parser.cpp"
break;
#line 2000 "Parser.cpp"
#line 1967 "Parser.cpp"
default: break;
}
......
......@@ -107,8 +107,9 @@ Program* pProgram(const char *str);
#define _SYMB_40 299
#define _SYMB_41 300
#define _SYMB_42 301
#define _STRING_ 302
#define _INTEGER_ 303
#define _SYMB_43 302
#define _STRING_ 303
#define _INTEGER_ 304
extern YYSTYPE yylval;
......
......@@ -367,64 +367,12 @@ void PrintAbsyn::visitAss(Ass *p)
_i_ = oldi;
}
void PrintAbsyn::visitTableAss(TableAss *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_1->accept(this);
render(']');
render('=');
_i_ = 0; p->expr_2->accept(this);
render(';');
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitTableIncr(TableIncr *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
render("++");
render(';');
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitTableDecr(TableDecr *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
render("--");
render(';');
if (oldi > 0) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitIncr(Incr *p)
{
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
_i_ = 0; p->expr_->accept(this);
render("++");
render(';');
......@@ -438,7 +386,7 @@ void PrintAbsyn::visitDecr(Decr *p)
int oldi = _i_;
if (oldi > 0) render(_L_PAREN);
visitPIdent(p->pident_);
_i_ = 0; p->expr_->accept(this);
render("--");
render(';');
......@@ -647,8 +595,7 @@ void PrintAbsyn::visitArray(Array *p)
if (oldi > 0) render(_L_PAREN);
_i_ = 0; p->type_->accept(this);
render('[');
render(']');
render("[]");
if (oldi > 0) render(_R_PAREN);
......@@ -696,47 +643,40 @@ void PrintAbsyn::visitListType(ListType *listtype)
void PrintAbsyn::visitEVar(EVar *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
if (oldi > 7) render(_L_PAREN);
visitPIdent(p->pident_);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitELitInt(ELitInt *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
visitInteger(p->integer_);
if (oldi > 6) render(_R_PAREN);
if (oldi > 7) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitELitTrue(ELitTrue *p)
void PrintAbsyn::visitEIndexAcc(EIndexAcc *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
if (oldi > 7) render(_L_PAREN);
render("true");
_i_ = 7; p->expr_1->accept(this);
render('[');
_i_ = 0; p->expr_2->accept(this);
render(']');
if (oldi > 6) render(_R_PAREN);
if (oldi > 7) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitELitFalse(ELitFalse *p)
void PrintAbsyn::visitEClsMmbr(EClsMmbr *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
if (oldi > 7) render(_L_PAREN);
render("false");
_i_ = 7; p->expr_->accept(this);
render('.');
visitPIdent(p->pident_);
if (oldi > 6) render(_R_PAREN);
if (oldi > 7) render(_R_PAREN);
_i_ = oldi;
}
......@@ -744,126 +684,104 @@ void PrintAbsyn::visitELitFalse(ELitFalse *p)
void PrintAbsyn::visitEApp(EApp *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
if (oldi > 7) render(_L_PAREN);
visitPIdent(p->pident_);
_i_ = 7; p->expr_->accept(this);
render('(');
if(p->listexpr_) {_i_ = 0; p->listexpr_->accept(this);}
render(')');
if (oldi > 6) render(_R_PAREN);
if (oldi > 7) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitEString(EString *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
visitString(p->string_);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitENewArray(ENewArray *p)
void PrintAbsyn::visitELitInt(ELitInt *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("new");
_i_ = 0; p->type_->accept(this);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
visitInteger(p->integer_);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitENewClass(ENewClass *p)
void PrintAbsyn::visitELitTrue(ELitTrue *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("new");
visitPIdent(p->pident_);
render("true");
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitEClsMmbr(EClsMmbr *p)
void PrintAbsyn::visitELitFalse(ELitFalse *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
_i_ = 6; p->expr_->accept(this);
render('.');
visitPIdent(p->pident_);
render("false");
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitEClsMthd(EClsMthd *p)
void PrintAbsyn::visitEString(EString *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
_i_ = 6; p->expr_->accept(this);
render('.');
visitPIdent(p->pident_);
render('(');
if(p->listexpr_) {_i_ = 0; p->listexpr_->accept(this);}
render(')');
visitString(p->string_);
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitNull(Null *p)
void PrintAbsyn::visitENewArray(ENewArray *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("null");
render("new");
_i_ = 0; p->type_->accept(this);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitEIndexAcc(EIndexAcc *p)
void PrintAbsyn::visitENewClass(ENewClass *p)
{
int oldi = _i_;
if (oldi > 6) render(_L_PAREN);
render("new");
visitPIdent(p->pident_);
render('[');
_i_ = 0; p->expr_->accept(this);
render(']');
if (oldi > 6) render(_R_PAREN);
_i_ = oldi;
}
void PrintAbsyn::visitECast(ECast *p)
void PrintAbsyn::visitNullCast(NullCast *p)
{
int oldi = _i_;
if (oldi > 5) render(_L_PAREN);
render('(');
visitPIdent(p->pident_);
_i_ = 0; p->expr_->accept(this);
render(')');
_i_ = 5; p->expr_->accept(this);
render("null");
if (oldi > 5) render(_R_PAREN);
......@@ -1406,25 +1324,10 @@ void ShowAbsyn::visitAss(Ass *p)
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitTableAss(TableAss *p)
{
bufAppend('(');
bufAppend("TableAss");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitTableIncr(TableIncr *p)
void ShowAbsyn::visitIncr(Incr *p)
{
bufAppend('(');
bufAppend("TableIncr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend("Incr");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
......@@ -1432,12 +1335,10 @@ void ShowAbsyn::visitTableIncr(TableIncr *p)
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitTableDecr(TableDecr *p)
void ShowAbsyn::visitDecr(Decr *p)
{
bufAppend('(');
bufAppend("TableDecr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend("Decr");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
......@@ -1445,24 +1346,6 @@ void ShowAbsyn::visitTableDecr(TableDecr *p)
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitIncr(Incr *p)
{
bufAppend('(');
bufAppend("Incr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitDecr(Decr *p)
{
bufAppend('(');
bufAppend("Decr");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitRet(Ret *p)
{
bufAppend('(');
......@@ -1534,7 +1417,7 @@ void ShowAbsyn::visitSExp(SExp *p)
void ShowAbsyn::visitForEach(ForEach *p)
{
bufAppend('(');
bufAppend("ForEa.h");
bufAppend("ForEach");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
......@@ -1655,122 +1538,100 @@ void ShowAbsyn::visitEVar(EVar *p)
visitPIdent(p->pident_);
bufAppend(')');
}
void ShowAbsyn::visitELitInt(ELitInt *p)
void ShowAbsyn::visitEIndexAcc(EIndexAcc *p)
{
bufAppend('(');
bufAppend("ELitInt");
bufAppend("EIndexAcc");
bufAppend(' ');
p->expr_1->accept(this);
bufAppend(' ');
p->expr_2->accept(this);
bufAppend(' ');
visitInteger(p->integer_);
bufAppend(')');
}
void ShowAbsyn::visitELitTrue(ELitTrue *p)
{
bufAppend("ELitTrue");
}
void ShowAbsyn::visitELitFalse(ELitFalse *p)
{
bufAppend("ELitFalse");
}
void ShowAbsyn::visitEApp(EApp *p)
void ShowAbsyn::visitEClsMmbr(EClsMmbr *p)
{
bufAppend('(');
bufAppend("EApp");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend("EClsMmbr");
bufAppend(' ');
bufAppend('[');
if (p->listexpr_) p->listexpr_->accept(this);
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(')');
}
void ShowAbsyn::visitEString(EString *p)
{
bufAppend('(');
bufAppend("EString");
bufAppend(' ');
visitString(p->string_);
bufAppend(')');
}
void ShowAbsyn::visitENewArray(ENewArray *p)
void ShowAbsyn::visitEApp(EApp *p)
{
bufAppend('(');
bufAppend("ENewArray");
bufAppend("EApp");
bufAppend(' ');
bufAppend('[');
if (p->type_) p->type_->accept(this);
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
if (p->listexpr_) p->listexpr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitENewClass(ENewClass *p)
void ShowAbsyn::visitELitInt(ELitInt *p)
{
bufAppend('(');
bufAppend("ENewClass");
bufAppend("ELitInt");
bufAppend(' ');
visitPIdent(p->pident_);
visitInteger(p->integer_);
bufAppend(')');
}
void ShowAbsyn::visitEClsMmbr(EClsMmbr *p)
void ShowAbsyn::visitELitTrue(ELitTrue *p)
{
bufAppend("ELitTrue");
}
void ShowAbsyn::visitELitFalse(ELitFalse *p)
{
bufAppend("ELitFalse");
}
void ShowAbsyn::visitEString(EString *p)
{
bufAppend('(');
bufAppend("EClsMmbr");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend("EString");
bufAppend(' ');
visitPIdent(p->pident_);
visitString(p->string_);
bufAppend(')');
}
void ShowAbsyn::visitEClsMthd(EClsMthd *p)
void ShowAbsyn::visitENewArray(ENewArray *p)
{
bufAppend('(');
bufAppend("EClsMthd");
bufAppend("ENewArray");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
if (p->type_) p->type_->accept(this);
bufAppend(']');
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->listexpr_) p->listexpr_->accept(this);
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitNull(Null *p)
{
bufAppend("Null");
}
void ShowAbsyn::visitEIndexAcc(EIndexAcc *p)
void ShowAbsyn::visitENewClass(ENewClass *p)
{
bufAppend('(');
bufAppend("EIndexAcc");
bufAppend("ENewClass");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitECast(ECast *p)
void ShowAbsyn::visitNullCast(NullCast *p)
{
bufAppend('(');
bufAppend("ECast");
bufAppend(' ');
visitPIdent(p->pident_);
bufAppend("NullCast");
bufAppend(' ');
bufAppend('[');
if (p->expr_) p->expr_->accept(this);
bufAppend(']');
bufAppend(' ');
bufAppend(')');
}
void ShowAbsyn::visitNeg(Neg *p)
......@@ -1892,7 +1753,7 @@ void ShowAbsyn::visitRelOp(RelOp *p) {} //abstract class
void ShowAbsyn::visitLTH(LTH *p)
{
bufAppend("L.h");
bufAppend("LTH");
}
void ShowAbsyn::visitLE(LE *p)
{
......@@ -1900,7 +1761,7 @@ void ShowAbsyn::visitLE(LE *p)
}
void ShowAbsyn::visitGTH(GTH *p)
{
bufAppend("G.h");
bufAppend("GTH");
}
void ShowAbsyn::visitGE(GE *p)
{
......@@ -1953,4 +1814,3 @@ void ShowAbsyn::visitPIdent(String s)
}
......@@ -58,9 +58,6 @@ class PrintAbsyn : public Visitor
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
......@@ -85,18 +82,16 @@ class PrintAbsyn : public Visitor
void visitListType(ListType *p);
void visitExpr(Expr *p); /* abstract class */
void visitEVar(EVar *p);
void visitEIndexAcc(EIndexAcc *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEApp(EApp *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNullCast(NullCast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
......@@ -231,9 +226,6 @@ class ShowAbsyn : public Visitor
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
......@@ -258,18 +250,16 @@ class ShowAbsyn : public Visitor
void visitListType(ListType *p);
void visitExpr(Expr *p); /* abstract class */
void visitEVar(EVar *p);
void visitEIndexAcc(EIndexAcc *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEApp(EApp *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNullCast(NullCast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
......@@ -370,4 +360,3 @@ class ShowAbsyn : public Visitor
#endif
......@@ -162,39 +162,11 @@ void Skeleton::visitAss(Ass *ass)
}
void Skeleton::visitTableAss(TableAss *table_ass)
{
/* Code For TableAss Goes Here */
table_ass->pident_->accept(this);
table_ass->expr_1->accept(this);
table_ass->expr_2->accept(this);
}
void Skeleton::visitTableIncr(TableIncr *table_incr)
{
/* Code For TableIncr Goes Here */
table_incr->pident_->accept(this);
table_incr->expr_->accept(this);
}
void Skeleton::visitTableDecr(TableDecr *table_decr)
{
/* Code For TableDecr Goes Here */
table_decr->pident_->accept(this);
table_decr->expr_->accept(this);
}
void Skeleton::visitIncr(Incr *incr)
{
/* Code For Incr Goes Here */
incr->pident_->accept(this);
incr->expr_->accept(this);
}
......@@ -202,7 +174,7 @@ void Skeleton::visitDecr(Decr *decr)
{
/* Code For Decr Goes Here */
decr->pident_->accept(this);
decr->expr_->accept(this);
}
......@@ -346,25 +318,21 @@ void Skeleton::visitEVar(EVar *e_var)
}
void Skeleton::visitELitInt(ELitInt *e_lit_int)
{
/* Code For ELitInt Goes Here */
visitInteger(e_lit_int->integer_);
}
void Skeleton::visitELitTrue(ELitTrue *e_lit_true)
void Skeleton::visitEIndexAcc(EIndexAcc *e_index_acc)
{
/* Code For ELitTrue Goes Here */
/* Code For EIndexAcc Goes Here */
e_index_acc->expr_1->accept(this);
e_index_acc->expr_2->accept(this);
}
void Skeleton::visitELitFalse(ELitFalse *e_lit_false)
void Skeleton::visitEClsMmbr(EClsMmbr *e_cls_mmbr)
{
/* Code For ELitFalse Goes Here */
/* Code For EClsMmbr Goes Here */
e_cls_mmbr->expr_->accept(this);
e_cls_mmbr->pident_->accept(this);
}
......@@ -372,77 +340,63 @@ void Skeleton::visitEApp(EApp *e_app)
{
/* Code For EApp Goes Here */
e_app->pident_->accept(this);
e_app->expr_->accept(this);
e_app->listexpr_->accept(this);
}
void Skeleton::visitEString(EString *e_string)
{
/* Code For EString Goes Here */
visitString(e_string->string_);
}
void Skeleton::visitENewArray(ENewArray *e_new_array)
void Skeleton::visitELitInt(ELitInt *e_lit_int)
{
/* Code For ENewArray Goes Here */
/* Code For ELitInt Goes Here */
e_new_array->type_->accept(this);
e_new_array->expr_->accept(this);
visitInteger(e_lit_int->integer_);
}
void Skeleton::visitENewClass(ENewClass *e_new_class)
void Skeleton::visitELitTrue(ELitTrue *e_lit_true)
{
/* Code For ENewClass Goes Here */
/* Code For ELitTrue Goes Here */
e_new_class->pident_->accept(this);
}
void Skeleton::visitEClsMmbr(EClsMmbr *e_cls_mmbr)
void Skeleton::visitELitFalse(ELitFalse *e_lit_false)
{
/* Code For EClsMmbr Goes Here */
/* Code For ELitFalse Goes Here */
e_cls_mmbr->expr_->accept(this);
e_cls_mmbr->pident_->accept(this);
}
void Skeleton::visitEClsMthd(EClsMthd *e_cls_mthd)
void Skeleton::visitEString(EString *e_string)
{
/* Code For EClsMthd Goes Here */
/* Code For EString Goes Here */
e_cls_mthd->expr_->accept(this);
e_cls_mthd->pident_->accept(this);
e_cls_mthd->listexpr_->accept(this);
visitString(e_string->string_);
}
void Skeleton::visitNull(Null *null)
void Skeleton::visitENewArray(ENewArray *e_new_array)
{
/* Code For Null Goes Here */
/* Code For ENewArray Goes Here */
e_new_array->type_->accept(this);
e_new_array->expr_->accept(this);
}
void Skeleton::visitEIndexAcc(EIndexAcc *e_index_acc)
void Skeleton::visitENewClass(ENewClass *e_new_class)
{
/* Code For EIndexAcc Goes Here */
/* Code For ENewClass Goes Here */
e_index_acc->pident_->accept(this);
e_index_acc->expr_->accept(this);
e_new_class->pident_->accept(this);
}
void Skeleton::visitECast(ECast *e_cast)
void Skeleton::visitNullCast(NullCast *null_cast)
{
/* Code For ECast Goes Here */
/* Code For NullCast Goes Here */
e_cast->pident_->accept(this);
e_cast->expr_->accept(this);
null_cast->expr_->accept(this);
}
......@@ -671,4 +625,3 @@ void Skeleton::visitIdent(Ident x)
}
......@@ -40,9 +40,6 @@ public:
void visitNoInit(NoInit *p);
void visitInit(Init *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
......@@ -60,18 +57,16 @@ public:
void visitClassT(ClassT *p);
void visitFun(Fun *p);
void visitEVar(EVar *p);
void visitEIndexAcc(EIndexAcc *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEApp(EApp *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNullCast(NullCast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
......@@ -108,4 +103,4 @@ public:
};
#endif
#endif
\ No newline at end of file
......@@ -122,51 +122,23 @@ void TypeCheck::visitDecl(Decl *decl)
el->expr_->accept(this);
VarInfoPtr var = make_shared<VarInfo>(el->pident_, type);
scope.currentBinding.variables << var;
scope.currentBinding->variables << var;
}
}
void TypeCheck::visitAss(Ass *ass)
{
auto var = scope.currentBinding.variables[]
// auto var = scope.currentBinding->variables[]
ass->expr_1->accept(this);
ass->expr_2->accept(this);
}
void TypeCheck::visitTableAss(TableAss *table_ass)
{
/* Code For TableAss Goes Here */
table_ass->pident_->accept(this);
table_ass->expr_1->accept(this);
table_ass->expr_2->accept(this);
}
void TypeCheck::visitTableIncr(TableIncr *table_incr)
{
/* Code For TableIncr Goes Here */
table_incr->pident_->accept(this);
table_incr->expr_->accept(this);
}
void TypeCheck::visitTableDecr(TableDecr *table_decr)
{
/* Code For TableDecr Goes Here */
table_decr->pident_->accept(this);
table_decr->expr_->accept(this);
}
void TypeCheck::visitIncr(Incr *incr)
{
/* Code For Incr Goes Here */
incr->pident_->accept(this);
incr->expr_->accept(this);
}
......@@ -174,7 +146,7 @@ void TypeCheck::visitDecr(Decr *decr)
{
/* Code For Decr Goes Here */
decr->pident_->accept(this);
decr->expr_->accept(this);
}
......@@ -301,6 +273,33 @@ void TypeCheck::visitEVar(EVar *e_var)
}
void TypeCheck::visitEIndexAcc(EIndexAcc *e_index_acc)
{
/* Code For EIndexAcc Goes Here */
e_index_acc->expr_1->accept(this);
e_index_acc->expr_2->accept(this);
}
void TypeCheck::visitEClsMmbr(EClsMmbr *e_cls_mmbr)
{
/* Code For EClsMmbr Goes Here */
e_cls_mmbr->expr_->accept(this);
e_cls_mmbr->pident_->accept(this);
}
void TypeCheck::visitEApp(EApp *e_app)
{
/* Code For EApp Goes Here */
e_app->expr_->accept(this);
e_app->listexpr_->accept(this);
}
void TypeCheck::visitELitInt(ELitInt *e_lit_int)
{
visitInteger(e_lit_int->integer_);
......@@ -317,15 +316,6 @@ void TypeCheck::visitELitFalse(ELitFalse *e_lit_false)
lastType = make_shared<Bool>();
}
void TypeCheck::visitEApp(EApp *e_app)
{
/* Code For EApp Goes Here */
e_app->pident_->accept(this);
e_app->listexpr_->accept(this);
}
void TypeCheck::visitEString(EString *e)
{
/* Code For EString Goes Here */
......@@ -359,48 +349,56 @@ void TypeCheck::visitENewClass(ENewClass *e_new_class)
lastType = make_shared<ClassT>(e_new_class->pident_);
}
void TypeCheck::visitEClsMmbr(EClsMmbr *e_cls_mmbr)
void TypeCheck::visitNullCast(NullCast *null_cast)
{
/* Code For EClsMmbr Goes Here */
/* Code For NullCast Goes Here */
e_cls_mmbr->expr_->accept(this);
e_cls_mmbr->pident_->accept(this);
null_cast->expr_->accept(this);
}
void TypeCheck::visitEClsMthd(EClsMthd *e_cls_mthd)
{
/* Code For EClsMthd Goes Here */
// void TypeCheck::visitEClsMmbr(EClsMmbr *e_cls_mmbr)
// {
// /* Code For EClsMmbr Goes Here */
e_cls_mthd->expr_->accept(this);
e_cls_mthd->pident_->accept(this);
e_cls_mthd->listexpr_->accept(this);
// e_cls_mmbr->expr_->accept(this);
// e_cls_mmbr->pident_->accept(this);
}
// }
void TypeCheck::visitNull(Null *e)
{
PIdent *ident = new PIdent("null", e->lineno);
lastType = make_shared<ClassT>(ident); // TODO
}
// void TypeCheck::visitEClsMthd(EClsMthd *e_cls_mthd)
// {
// /* Code For EClsMthd Goes Here */
void TypeCheck::visitEIndexAcc(EIndexAcc *e_index_acc)
{
/* Code For EIndexAcc Goes Here */
// e_cls_mthd->expr_->accept(this);
// e_cls_mthd->pident_->accept(this);
// e_cls_mthd->listexpr_->accept(this);
e_index_acc->pident_->accept(this);
e_index_acc->expr_->accept(this);
throw UndefinedError(e_index_acc->pident_); // TODO
}
// }
void TypeCheck::visitECast(ECast *e_cast)
{
/* Code For ECast Goes Here */
// void TypeCheck::visitNull(Null *e)
// {
// PIdent *ident = new PIdent("null", e->lineno);
// lastType = make_shared<ClassT>(ident); // TODO
// }
e_cast->pident_->accept(this);
e_cast->expr_->accept(this);
lastType = make_shared<ClassT>(e_cast->pident_);
}
// void TypeCheck::visitEIndexAcc(EIndexAcc *e_index_acc)
// {
// /* Code For EIndexAcc Goes Here */
// e_index_acc->pident_->accept(this);
// e_index_acc->expr_->accept(this);
// throw UndefinedError(e_index_acc->pident_); // TODO
// }
// void TypeCheck::visitECast(ECast *e_cast)
// {
// /* Code For ECast Goes Here */
// e_cast->pident_->accept(this);
// e_cast->expr_->accept(this);
// lastType = make_shared<ClassT>(e_cast->pident_);
// }
void TypeCheck::visitNeg(Neg *e)
{
......
......@@ -37,9 +37,6 @@ protected:
void visitBStmt(BStmt *p);
void visitDecl(Decl *p);
void visitAss(Ass *p);
void visitTableAss(TableAss *p);
void visitTableIncr(TableIncr *p);
void visitTableDecr(TableDecr *p);
void visitIncr(Incr *p);
void visitDecr(Decr *p);
void visitRet(Ret *p);
......@@ -57,18 +54,16 @@ protected:
void visitClassT(ClassT *p);
void visitFun(Fun *p);
void visitEVar(EVar *p);
void visitEIndexAcc(EIndexAcc *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEApp(EApp *p);
void visitELitInt(ELitInt *p);
void visitELitTrue(ELitTrue *p);
void visitELitFalse(ELitFalse *p);
void visitEApp(EApp *p);
void visitEString(EString *p);
void visitENewArray(ENewArray *p);
void visitENewClass(ENewClass *p);
void visitEClsMmbr(EClsMmbr *p);
void visitEClsMthd(EClsMthd *p);
void visitNull(Null *p);
void visitEIndexAcc(EIndexAcc *p);
void visitECast(ECast *p);
void visitNullCast(NullCast *p);
void visitNeg(Neg *p);
void visitNot(Not *p);
void visitEMul(EMul *p);
......
......@@ -48,9 +48,6 @@ class Decl;
using NoInit = Item;
using Init = Item;
class Ass;
class TableAss;
class TableIncr;
class TableDecr;
class Incr;
class Decr;
class Ret;
......@@ -68,18 +65,16 @@ class Array;
class ClassT;
class Fun;
class EVar;
class EIndexAcc;
class EClsMmbr;
class EApp;
class ELitInt;
class ELitTrue;
class ELitFalse;
class EApp;
class EString;
class ENewArray;
class ENewClass;
class EClsMmbr;
class EClsMthd;
class Null;
class EIndexAcc;
class ECast;
class NullCast;
class Neg;
class Not;
class EMul;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment