Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
latte
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zygzagZ
latte
Commits
0cd3f111
Commit
0cd3f111
authored
Dec 10, 2020
by
zygzagZ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nowa wersja gramatyki
parent
513b2d53
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
964 additions
and
1529 deletions
+964
-1529
.gitignore
.gitignore
+1
-0
Absyn.cpp
Absyn.cpp
+151
-395
Absyn.h
Absyn.h
+62
-142
Lexer.cpp
Lexer.cpp
+130
-125
Parser.cpp
Parser.cpp
+412
-445
Parser.h
Parser.h
+3
-2
Printer.cpp
Printer.cpp
+84
-224
Printer.h
Printer.h
+8
-19
Skeleton.cpp
Skeleton.cpp
+31
-78
Skeleton.h
Skeleton.h
+5
-10
TypeCheck.cpp
TypeCheck.cpp
+69
-71
TypeCheck.h
TypeCheck.h
+4
-9
TypeDefs.h
TypeDefs.h
+4
-9
No files found.
.gitignore
View file @
0cd3f111
t.cpp
t.e
*.o
*.l
*.y
...
...
Absyn.cpp
View file @
0cd3f111
...
...
@@ -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
;
}
E
LitTrue
::
ELitTrue
(
const
ELitTrue
&
other
)
E
IndexAcc
::
EIndexAcc
(
const
EIndexAcc
&
other
)
{
expr_1
=
other
.
expr_1
->
clone
();
expr_2
=
other
.
expr_2
->
clone
();
}
E
LitTrue
&
ELitTrue
::
operator
=
(
const
ELitTrue
&
other
)
E
IndexAcc
&
EIndexAcc
::
operator
=
(
const
EIndexAcc
&
other
)
{
ELitTrue
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
EIndexAcc
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
E
LitTrue
::
swap
(
ELitTrue
&
other
)
void
E
IndexAcc
::
swap
(
EIndexAcc
&
other
)
{
std
::
swap
(
expr_1
,
other
.
expr_1
);
std
::
swap
(
expr_2
,
other
.
expr_2
);
}
E
LitTrue
::~
ELitTrue
()
E
IndexAcc
::~
EIndexAcc
()
{
delete
(
expr_1
);
delete
(
expr_2
);
}
void
E
LitTrue
::
accept
(
Visitor
*
v
)
void
E
IndexAcc
::
accept
(
Visitor
*
v
)
{
v
->
visitELitTrue
(
this
);
v
->
visitEIndexAcc
(
this
);
}
E
LitTrue
*
ELitTrue
::
clone
()
const
E
IndexAcc
*
EIndexAcc
::
clone
()
const
{
return
new
ELitTrue
(
*
this
);
return
new
EIndexAcc
(
*
this
);
}
/******************** E
LitFalse
********************/
E
LitFalse
::
ELitFalse
(
)
/******************** E
ClsMmbr
********************/
E
ClsMmbr
::
EClsMmbr
(
Expr
*
p1
,
PIdent
*
p2
)
{
expr_
=
p1
;
pident_
=
p2
;
}
E
LitFalse
::
ELitFalse
(
const
ELitFalse
&
other
)
E
ClsMmbr
::
EClsMmbr
(
const
EClsMmbr
&
other
)
{
expr_
=
other
.
expr_
->
clone
();
pident_
=
other
.
pident_
->
clone
();
}
E
LitFalse
&
ELitFalse
::
operator
=
(
const
ELitFalse
&
other
)
E
ClsMmbr
&
EClsMmbr
::
operator
=
(
const
EClsMmbr
&
other
)
{
ELitFalse
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
EClsMmbr
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
E
LitFalse
::
swap
(
ELitFalse
&
other
)
void
E
ClsMmbr
::
swap
(
EClsMmbr
&
other
)
{
std
::
swap
(
expr_
,
other
.
expr_
);
std
::
swap
(
pident_
,
other
.
pident_
);
}
E
LitFalse
::~
ELitFalse
()
E
ClsMmbr
::~
EClsMmbr
()
{
delete
(
expr_
);
delete
(
pident_
);
}
void
E
LitFalse
::
accept
(
Visitor
*
v
)
void
E
ClsMmbr
::
accept
(
Visitor
*
v
)
{
v
->
visitELitFalse
(
this
);
v
->
visitEClsMmbr
(
this
);
}
E
LitFalse
*
ELitFalse
::
clone
()
const
E
ClsMmbr
*
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
/******************** E
String
********************/
E
String
::
EString
(
String
p1
)
/******************** E
LitInt
********************/
E
LitInt
::
ELitInt
(
Integer
p1
)
{
string
_
=
p1
;
integer
_
=
p1
;
}
E
String
::
EString
(
const
EString
&
other
)
E
LitInt
::
ELitInt
(
const
ELitInt
&
other
)
{
string_
=
other
.
string
_
;
integer_
=
other
.
integer
_
;
}
E
String
&
EString
::
operator
=
(
const
EString
&
other
)
E
LitInt
&
ELitInt
::
operator
=
(
const
ELitInt
&
other
)
{
E
String
tmp
(
other
);
E
LitInt
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
E
String
::
swap
(
EString
&
other
)
void
E
LitInt
::
swap
(
ELitInt
&
other
)
{
std
::
swap
(
string_
,
other
.
string
_
);
std
::
swap
(
integer_
,
other
.
integer
_
);
}
E
String
::~
EString
()
E
LitInt
::~
ELitInt
()
{
}
void
E
String
::
accept
(
Visitor
*
v
)
void
E
LitInt
::
accept
(
Visitor
*
v
)
{
v
->
visitE
String
(
this
);
v
->
visitE
LitInt
(
this
);
}
E
String
*
EString
::
clone
()
const
E
LitInt
*
ELitInt
::
clone
()
const
{
return
new
E
String
(
*
this
);
return
new
E
LitInt
(
*
this
);
}
/******************** E
NewArray
********************/
E
NewArray
::
ENewArray
(
Type
*
p1
,
Expr
*
p2
)
/******************** E
LitTrue
********************/
E
LitTrue
::
ELitTrue
(
)
{
type_
=
p1
;
expr_
=
p2
;
}
E
NewArray
::
ENewArray
(
const
ENewArray
&
other
)
E
LitTrue
::
ELitTrue
(
const
ELitTrue
&
other
)
{
type_
=
other
.
type_
->
clone
();
expr_
=
other
.
expr_
->
clone
();
}
E
NewArray
&
ENewArray
::
operator
=
(
const
ENewArray
&
other
)
E
LitTrue
&
ELitTrue
::
operator
=
(
const
ELitTrue
&
other
)
{
E
NewArray
tmp
(
other
);
E
LitTrue
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
E
NewArray
::
swap
(
ENewArray
&
other
)
void
E
LitTrue
::
swap
(
ELitTrue
&
other
)
{
std
::
swap
(
type_
,
other
.
type_
);
std
::
swap
(
expr_
,
other
.
expr_
);
}
E
NewArray
::~
ENewArray
()
E
LitTrue
::~
ELitTrue
()
{
delete
(
type_
);
delete
(
expr_
);
}
void
E
NewArray
::
accept
(
Visitor
*
v
)
void
E
LitTrue
::
accept
(
Visitor
*
v
)
{
v
->
visitE
NewArray
(
this
);
v
->
visitE
LitTrue
(
this
);
}
E
NewArray
*
ENewArray
::
clone
()
const
E
LitTrue
*
ELitTrue
::
clone
()
const
{
return
new
E
NewArray
(
*
this
);
return
new
E
LitTrue
(
*
this
);
}
/******************** E
NewClass
********************/
E
NewClass
::
ENewClass
(
PIdent
*
p1
)
/******************** E
LitFalse
********************/
E
LitFalse
::
ELitFalse
(
)
{
pident_
=
p1
;
}
E
NewClass
::
ENewClass
(
const
ENewClass
&
other
)
E
LitFalse
::
ELitFalse
(
const
ELitFalse
&
other
)
{
pident_
=
other
.
pident_
->
clone
();
}
E
NewClass
&
ENewClass
::
operator
=
(
const
ENewClass
&
other
)
E
LitFalse
&
ELitFalse
::
operator
=
(
const
ELitFalse
&
other
)
{
E
NewClass
tmp
(
other
);
E
LitFalse
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
E
NewClass
::
swap
(
ENewClass
&
other
)
void
E
LitFalse
::
swap
(
ELitFalse
&
other
)
{
std
::
swap
(
pident_
,
other
.
pident_
);
}
E
NewClass
::~
ENewClass
()
E
LitFalse
::~
ELitFalse
()
{
delete
(
pident_
);
}
void
E
NewClass
::
accept
(
Visitor
*
v
)
void
E
LitFalse
::
accept
(
Visitor
*
v
)
{
v
->
visitE
NewClass
(
this
);
v
->
visitE
LitFalse
(
this
);
}
E
NewClass
*
ENewClass
::
clone
()
const
E
LitFalse
*
ELitFalse
::
clone
()
const
{
return
new
E
NewClass
(
*
this
);
return
new
E
LitFalse
(
*
this
);
}
/******************** E
ClsMmbr
********************/
E
ClsMmbr
::
EClsMmbr
(
Expr
*
p1
,
PIdent
*
p2
)
/******************** E
String
********************/
E
String
::
EString
(
String
p1
)
{
expr_
=
p1
;
pident_
=
p2
;
string_
=
p1
;
}
E
ClsMmbr
::
EClsMmbr
(
const
EClsMmbr
&
other
)
E
String
::
EString
(
const
EString
&
other
)
{
expr_
=
other
.
expr_
->
clone
();
pident_
=
other
.
pident_
->
clone
();
string_
=
other
.
string_
;
}
E
ClsMmbr
&
EClsMmbr
::
operator
=
(
const
EClsMmbr
&
other
)
E
String
&
EString
::
operator
=
(
const
EString
&
other
)
{
E
ClsMmbr
tmp
(
other
);
E
String
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
E
ClsMmbr
::
swap
(
EClsMmbr
&
other
)
void
E
String
::
swap
(
EString
&
other
)
{
std
::
swap
(
expr_
,
other
.
expr_
);
std
::
swap
(
pident_
,
other
.
pident_
);
std
::
swap
(
string_
,
other
.
string_
);
}
E
ClsMmbr
::~
EClsMmbr
()
E
String
::~
EString
()
{
delete
(
expr_
);
delete
(
pident_
);
}
void
E
ClsMmbr
::
accept
(
Visitor
*
v
)
void
E
String
::
accept
(
Visitor
*
v
)
{
v
->
visitE
ClsMmbr
(
this
);
v
->
visitE
String
(
this
);
}
E
ClsMmbr
*
EClsMmbr
::
clone
()
const
E
String
*
EString
::
clone
()
const
{
return
new
E
ClsMmbr
(
*
this
);
return
new
E
String
(
*
this
);
}
/******************** E
ClsMthd
********************/
E
ClsMthd
::
EClsMthd
(
Expr
*
p1
,
PIdent
*
p2
,
ListExpr
*
p3
)
/******************** E
NewArray
********************/
E
NewArray
::
ENewArray
(
Type
*
p1
,
Expr
*
p2
)
{
expr_
=
p1
;
pident_
=
p2
;
listexpr_
=
p3
;
type_
=
p1
;
expr_
=
p2
;
}
E
ClsMthd
::
EClsMthd
(
const
EClsMthd
&
other
)
E
NewArray
::
ENewArray
(
const
ENewArray
&
other
)
{
type_
=
other
.
type_
->
clone
();
expr_
=
other
.
expr_
->
clone
();
pident_
=
other
.
pident_
->
clone
();
listexpr_
=
other
.
listexpr_
->
clone
();
}
E
ClsMthd
&
EClsMthd
::
operator
=
(
const
EClsMthd
&
other
)
E
NewArray
&
ENewArray
::
operator
=
(
const
ENewArray
&
other
)
{
E
ClsMthd
tmp
(
other
);
E
NewArray
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
E
ClsMthd
::
swap
(
EClsMthd
&
other
)
void
E
NewArray
::
swap
(
ENewArray
&
other
)
{
std
::
swap
(
type_
,
other
.
type_
);
std
::
swap
(
expr_
,
other
.
expr_
);
std
::
swap
(
pident_
,
other
.
pident_
);
std
::
swap
(
listexpr_
,
other
.
listexpr_
);
}
E
ClsMthd
::~
EClsMthd
()
E
NewArray
::~
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
->
visit
Null
(
this
);
v
->
visit
ENewArray
(
this
);
}
Null
*
Null
::
clone
()
const
ENewArray
*
ENewArray
::
clone
()
const
{
return
new
Null
(
*
this
);
return
new
ENewArray
(
*
this
);
}
/******************** E
IndexAcc
********************/
E
IndexAcc
::
EIndexAcc
(
PIdent
*
p1
,
Expr
*
p2
)
/******************** E
NewClass
********************/
E
NewClass
::
ENewClass
(
PIdent
*
p1
)
{
pident_
=
p1
;
expr_
=
p2
;
}
E
IndexAcc
::
EIndexAcc
(
const
EIndexAcc
&
other
)
E
NewClass
::
ENewClass
(
const
ENewClass
&
other
)
{
pident_
=
other
.
pident_
->
clone
();
expr_
=
other
.
expr_
->
clone
();
}
E
IndexAcc
&
EIndexAcc
::
operator
=
(
const
EIndexAcc
&
other
)
E
NewClass
&
ENewClass
::
operator
=
(
const
ENewClass
&
other
)
{
E
IndexAcc
tmp
(
other
);
E
NewClass
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
E
IndexAcc
::
swap
(
EIndexAcc
&
other
)
void
E
NewClass
::
swap
(
ENewClass
&
other
)
{
std
::
swap
(
pident_
,
other
.
pident_
);
std
::
swap
(
expr_
,
other
.
expr_
);
}
E
IndexAcc
::~
EIndexAcc
()
E
NewClass
::~
ENewClass
()
{
delete
(
pident_
);
delete
(
expr_
);
}
void
E
IndexAcc
::
accept
(
Visitor
*
v
)
void
E
NewClass
::
accept
(
Visitor
*
v
)
{
v
->
visitE
IndexAcc
(
this
);
v
->
visitE
NewClass
(
this
);
}
E
IndexAcc
*
EIndexAcc
::
clone
()
const
E
NewClass
*
ENewClass
::
clone
()
const
{
return
new
E
IndexAcc
(
*
this
);
return
new
E
NewClass
(
*
this
);
}
/********************
E
Cast ********************/
ECast
::
ECast
(
PIdent
*
p1
,
Expr
*
p2
)
/********************
Null
Cast ********************/
NullCast
::
NullCast
(
Expr
*
p1
)
{
pident_
=
p1
;
expr_
=
p2
;
expr_
=
p1
;
}
ECast
::
ECast
(
const
E
Cast
&
other
)
NullCast
::
NullCast
(
const
Null
Cast
&
other
)
{
pident_
=
other
.
pident_
->
clone
();
expr_
=
other
.
expr_
->
clone
();
expr_
=
other
.
expr_
->
clone
();
}
ECast
&
ECast
::
operator
=
(
const
E
Cast
&
other
)
NullCast
&
NullCast
::
operator
=
(
const
Null
Cast
&
other
)
{
E
Cast
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
Null
Cast
tmp
(
other
);
swap
(
tmp
);
return
*
this
;
}
void
ECast
::
swap
(
E
Cast
&
other
)
void
NullCast
::
swap
(
Null
Cast
&
other
)
{
std
::
swap
(
pident_
,
other
.
pident_
);
std
::
swap
(
expr_
,
other
.
expr_
);
std
::
swap
(
expr_
,
other
.
expr_
);
}
ECast
::~
E
Cast
()
NullCast
::~
Null
Cast
()
{
delete
(
pident_
);
delete
(
expr_
);
delete
(
expr_
);
}
void
E
Cast
::
accept
(
Visitor
*
v
)
void
Null
Cast
::
accept
(
Visitor
*
v
)
{
v
->
visitE
Cast
(
this
);
v
->
visitNull
Cast
(
this
);
}
ECast
*
E
Cast
::
clone
()
const
NullCast
*
Null
Cast
::
clone
()
const
{
return
new
E
Cast
(
*
this
);
return
new
Null
Cast
(
*
this
);
}
...
...
Absyn.h
View file @
0cd3f111
...
...
@@ -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
E
Cast
&
);
ECast
&
operator
=
(
const
E
Cast
&
);
ECast
(
PIdent
*
p1
,
Expr
*
p2
);
~
E
Cast
();
NullCast
(
const
Null
Cast
&
);
NullCast
&
operator
=
(
const
Null
Cast
&
);
NullCast
(
Expr
*
p1
);
~
Null
Cast
();
virtual
void
accept
(
Visitor
*
v
);
virtual
E
Cast
*
clone
()
const
;
void
swap
(
E
Cast
&
);
virtual
Null
Cast
*
clone
()
const
;
void
swap
(
Null
Cast
&
);
};
class
Neg
:
public
Expr
...
...
Lexer.cpp
View file @
0cd3f111
...
...
@@ -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 6
3
#define YY_END_OF_BUFFER 6
4
#define YY_NUM_RULES 6
4
#define YY_END_OF_BUFFER 6
5
/* 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
[
14
1
]
=
static
const
flex_int16_t
yy_accept
[
14
2
]
=
{
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
[
14
8
]
=
static
const
flex_int16_t
yy_base
[
14
9
]
=
{
0
,
1
59
,
158
,
0
,
0
,
48
,
49
,
157
,
156
,
155
,
154
,
15
3
,
152
,
50
,
51
,
54
,
59
,
154
,
163
,
163
,
163
,
16
3
,
163
,
131
,
163
,
149
,
163
,
143
,
163
,
163
,
163
,
13
7
,
163
,
134
,
163
,
46
,
130
,
163
,
163
,
125
,
124
,
12
3
,
0
,
163
,
163
,
104
,
105
,
27
,
38
,
32
,
35
,
109
,
98
,
99
,
99
,
102
,
16
3
,
88
,
163
,
163
,
163
,
119
,
16
3
,
163
,
163
,
163
,
163
,
163
,
163
,
163
,
163
,
132
,
16
3
,
163
,
163
,
163
,
163
,
131
,
115
,
163
,
163
,
16
3
,
0
,
92
,
102
,
88
,
86
,
90
,
86
,
0
,
83
,
79
,
86
,
80
,
81
,
77
,
83
,
82
,
163
,
163
,
115
,
1
63
,
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
1
60
,
159
,
0
,
0
,
48
,
49
,
158
,
157
,
156
,
155
,
15
4
,
153
,
50
,
51
,
54
,
59
,
155
,
164
,
164
,
164
,
16
4
,
164
,
132
,
164
,
150
,
164
,
144
,
164
,
164
,
164
,
13
8
,
164
,
135
,
164
,
46
,
131
,
164
,
164
,
126
,
125
,
12
4
,
0
,
118
,
164
,
104
,
105
,
27
,
38
,
32
,
35
,
109
,
98
,
99
,
99
,
102
,
16
4
,
88
,
164
,
164
,
164
,
119
,
16
4
,
164
,
164
,
164
,
164
,
164
,
164
,
164
,
164
,
132
,
16
4
,
164
,
164
,
164
,
164
,
131
,
115
,
164
,
164
,
16
4
,
0
,
164
,
92
,
102
,
88
,
86
,
90
,
86
,
0
,
83
,
79
,
86
,
80
,
81
,
77
,
83
,
82
,
164
,
164
,
1
15
,
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
,
1
64
,
1
02
,
104
,
106
,
108
,
110
,
67
,
112
}
;
static
const
flex_int16_t
yy_def
[
14
8
]
=
static
const
flex_int16_t
yy_def
[
14
9
]
=
{
0
,
14
1
,
141
,
140
,
3
,
142
,
142
,
141
,
141
,
141
,
141
,
14
1
,
141
,
143
,
143
,
144
,
144
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
145
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
146
,
140
,
140
,
146
,
146
,
146
,
146
,
146
,
146
,
14
6
,
146
,
146
,
146
,
146
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
5
,
140
,
140
,
140
,
140
,
140
,
147
,
140
,
140
,
140
,
14
0
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
14
6
,
146
,
146
,
146
,
146
,
146
,
146
,
140
,
140
,
147
,
14
0
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
14
6
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
14
6
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
14
6
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
146
,
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
14
2
,
142
,
141
,
3
,
143
,
143
,
142
,
142
,
142
,
142
,
14
2
,
142
,
144
,
144
,
145
,
145
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
146
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
147
,
141
,
141
,
147
,
147
,
147
,
147
,
147
,
147
,
14
7
,
147
,
147
,
147
,
147
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
6
,
141
,
141
,
141
,
141
,
141
,
148
,
141
,
141
,
141
,
14
1
,
147
,
141
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
14
7
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
141
,
141
,
14
8
,
141
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
14
7
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
14
7
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
14
7
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
147
,
0
,
141
,
141
,
141
,
141
,
141
,
141
,
141
}
;
static
const
flex_int16_t
yy_nxt
[
21
4
]
=
static
const
flex_int16_t
yy_nxt
[
21
5
]
=
{
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
,
8
5
,
89
,
87
,
91
,
82
,
139
,
9
0
,
138
,
137
,
86
,
136
,
64
,
64
,
88
,
92
,
67
,
13
5
,
134
,
133
,
132
,
67
,
131
,
130
,
129
,
128
,
127
,
12
6
,
125
,
68
,
124
,
123
,
122
,
69
,
68
,
121
,
120
,
1
19
,
69
,
18
,
18
,
59
,
59
,
62
,
62
,
65
,
65
,
71
,
71
,
10
0
,
100
,
118
,
117
,
116
,
101
,
115
,
114
,
11
3
,
112
,
111
,
110
,
109
,
108
,
107
,
106
,
105
,
104
,
10
3
,
102
,
78
,
101
,
72
,
99
,
98
,
97
,
96
,
95
,
9
4
,
93
,
84
,
83
,
81
,
80
,
79
,
78
,
75
,
74
,
7
3
,
72
,
70
,
140
,
19
,
19
,
19
,
19
,
19
,
19
,
19
,
19
,
1
7
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
61
,
19
,
77
,
66
,
8
6
,
90
,
88
,
92
,
82
,
140
,
9
1
,
139
,
138
,
87
,
137
,
64
,
64
,
89
,
93
,
67
,
13
6
,
135
,
134
,
133
,
67
,
132
,
131
,
130
,
129
,
128
,
12
7
,
126
,
68
,
125
,
124
,
123
,
69
,
68
,
122
,
121
,
1
20
,
69
,
18
,
18
,
59
,
59
,
62
,
62
,
65
,
65
,
71
,
71
,
10
1
,
101
,
119
,
118
,
117
,
102
,
116
,
115
,
11
4
,
113
,
112
,
111
,
110
,
109
,
108
,
107
,
106
,
105
,
10
4
,
103
,
78
,
102
,
72
,
100
,
99
,
98
,
97
,
96
,
9
5
,
94
,
85
,
84
,
83
,
81
,
80
,
79
,
78
,
75
,
7
4
,
73
,
72
,
70
,
141
,
19
,
19
,
19
,
19
,
19
,
19
,
19
,
1
9
,
17
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
}
;
static
const
flex_int16_t
yy_chk
[
21
4
]
=
static
const
flex_int16_t
yy_chk
[
21
5
]
=
{
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
,
14
6
,
135
,
49
,
13
4
,
132
,
47
,
131
,
13
,
14
,
48
,
50
,
15
,
1
29
,
127
,
126
,
123
,
16
,
122
,
120
,
119
,
117
,
116
,
11
5
,
114
,
15
,
113
,
112
,
111
,
15
,
16
,
110
,
106
,
10
5
,
16
,
141
,
141
,
142
,
142
,
143
,
143
,
144
,
144
,
14
5
,
145
,
147
,
147
,
104
,
103
,
102
,
100
,
97
,
96
,
9
5
,
94
,
93
,
92
,
91
,
90
,
88
,
87
,
86
,
85
,
8
4
,
83
,
78
,
77
,
71
,
61
,
57
,
55
,
54
,
53
,
52
,
51
,
46
,
45
,
4
1
,
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
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
140
,
14
0
,
140
,
140
6
,
16
,
35
,
16
,
47
,
49
,
48
,
50
,
14
7
,
136
,
49
,
13
5
,
133
,
47
,
132
,
13
,
14
,
48
,
50
,
15
,
1
30
,
128
,
127
,
124
,
16
,
123
,
121
,
120
,
118
,
117
,
11
6
,
115
,
15
,
114
,
113
,
112
,
15
,
16
,
111
,
107
,
10
6
,
16
,
142
,
142
,
143
,
143
,
144
,
144
,
145
,
145
,
14
6
,
146
,
148
,
148
,
105
,
104
,
103
,
101
,
98
,
97
,
9
6
,
95
,
94
,
93
,
92
,
91
,
89
,
88
,
87
,
86
,
8
5
,
84
,
78
,
77
,
71
,
61
,
57
,
55
,
54
,
53
,
52
,
51
,
46
,
45
,
4
3
,
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
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
141
,
14
1
,
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 55
2
"Lexer.cpp"
#line 55
3
"Lexer.cpp"
#line 55
4
"Lexer.cpp"
#line 55
5
"Lexer.cpp"
#define INITIAL 0
#define YYINITIAL 1
...
...
@@ -778,7 +779,7 @@ YY_DECL
#line 27 "Grammar.l"
#line 78
1
"Lexer.cpp"
#line 78
2
"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
>=
14
1
)
if
(
yy_current_state
>=
14
2
)
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
]
!=
16
3
);
while
(
yy_base
[
yy_current_state
]
!=
16
4
);
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 7
2
"Grammar.l"
++
yy_mylinenumber
;
// BNFC: comment "#"
;
#line 7
1
"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 7
9
"Grammar.l"
yylval
.
string_
=
strdup
(
yytext
);
return
_SYMB_42
;
#line 7
8
"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 11
58
"Lexer.cpp"
#line 11
64
"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
>=
14
1
)
if
(
yy_current_state
>=
14
2
)
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
>=
14
1
)
if
(
yy_current_state
>=
14
2
)
yy_c
=
yy_meta
[
yy_c
];
}
yy_current_state
=
yy_nxt
[
yy_base
[
yy_current_state
]
+
yy_c
];
yy_is_jam
=
(
yy_current_state
==
14
0
);
yy_is_jam
=
(
yy_current_state
==
14
1
);
return
yy_is_jam
?
0
:
yy_current_state
;
}
...
...
@@ -2167,9 +2173,8 @@ void yyfree (void * ptr )
#define YYTABLES_NAME "yytables"
#line 9
3
"Grammar.l"
#line 9
4
"Grammar.l"
void
initialize_lexer
(
FILE
*
inp
)
{
yyrestart
(
inp
);
BEGIN
YYINITIAL
;
}
int
yywrap
(
void
)
{
return
1
;
}
Parser.cpp
View file @
0cd3f111
...
...
@@ -52,7 +52,7 @@
#define YYBISON_VERSION "3.7.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c
pp
"
#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 29
3
"Parser.cpp"
#line 29
4
"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 pu
s
h") \
_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 pu
s
h") \
_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 2
51
#define YYLAST 2
06
/* 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 8
9
#define YYNRULES 8
5
/* YYNSTATES -- Number of states. */
#define YYNSTATES 1
65
#define YYNSTATES 1
51
/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 30
3
#define YYMAXUTOK 30
4
/* 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
,
21
0
,
210
,
212
,
213
,
215
,
216
,
218
,
220
,
222
,
22
3
,
224
,
226
,
227
,
229
,
231
,
232
,
234
,
235
,
237
,
2
39
,
240
,
242
,
243
,
244
,
245
,
246
,
247
,
248
,
249
,
25
0
,
251
,
252
,
253
,
254
,
255
,
256
,
257
,
259
,
260
,
26
2
,
263
,
265
,
266
,
267
,
268
,
269
,
270
,
276
,
277
,
2
78
,
279
,
280
,
281
,
282
,
283
,
284
,
285
,
286
,
287
,
2
88
,
290
,
291
,
292
,
293
,
295
,
296
,
298
,
299
,
301
,
30
2
,
304
,
305
,
307
,
308
,
310
,
311
,
312
,
314
,
315
,
3
17
,
318
,
319
,
321
,
322
,
323
,
324
,
325
,
326
,
328
0
,
21
2
,
212
,
214
,
215
,
217
,
218
,
220
,
222
,
224
,
22
5
,
226
,
228
,
229
,
231
,
233
,
234
,
236
,
237
,
239
,
2
41
,
242
,
244
,
245
,
246
,
247
,
248
,
249
,
250
,
251
,
25
2
,
253
,
254
,
255
,
256
,
258
,
259
,
261
,
262
,
264
,
26
5
,
266
,
267
,
268
,
269
,
275
,
276
,
277
,
278
,
279
,
2
81
,
282
,
283
,
284
,
285
,
286
,
287
,
289
,
290
,
291
,
2
92
,
294
,
295
,
297
,
298
,
300
,
301
,
303
,
304
,
306
,
30
7
,
309
,
310
,
311
,
313
,
314
,
316
,
317
,
318
,
320
,
3
21
,
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 (-4
8
)
#define YYTABLE_NINF (-4
5
)
#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
,
2
6
,
27
,
11
,
21
,
31
,
2
4
,
72
,
46
,
73
,
37
,
38
,
74
,
58
,
59
,
60
,
61
,
62
,
63
,
75
,
124
,
91
,
88
,
99
,
65
-
1
,
7
,
8
,
9
,
10
,
2
5
,
26
,
11
,
21
,
30
,
2
3
,
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
,
5
5
,
55
,
56
,
56
,
57
,
58
,
58
,
59
,
59
,
60
,
6
1
,
61
,
62
,
62
,
62
,
62
,
62
,
62
,
62
,
62
,
6
2
,
62
,
62
,
62
,
62
,
62
,
62
,
62
,
63
,
63
,
6
4
,
64
,
65
,
65
,
65
,
65
,
65
,
65
,
66
,
66
,
6
6
,
66
,
66
,
66
,
66
,
66
,
66
,
66
,
66
,
66
,
6
6
,
67
,
67
,
67
,
67
,
68
,
68
,
69
,
69
,
70
,
7
0
,
71
,
71
,
72
,
72
,
73
,
73
,
73
,
74
,
74
,
7
5
,
75
,
75
,
76
,
76
,
76
,
76
,
76
,
76
,
77
0
,
50
,
51
,
52
,
52
,
53
,
53
,
54
,
55
,
56
,
5
6
,
56
,
57
,
57
,
58
,
59
,
59
,
60
,
60
,
61
,
6
2
,
62
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
63
,
6
3
,
63
,
63
,
63
,
63
,
64
,
64
,
65
,
65
,
66
,
6
6
,
66
,
66
,
66
,
66
,
67
,
67
,
67
,
67
,
67
,
6
8
,
68
,
68
,
68
,
68
,
68
,
68
,
69
,
69
,
69
,
6
9
,
70
,
70
,
71
,
71
,
72
,
72
,
73
,
73
,
74
,
7
4
,
75
,
75
,
75
,
76
,
76
,
77
,
77
,
77
,
78
,
7
8
,
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 21
0
"Grammar.y"
#line 21
2
"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 14
74
"Parser.cpp"
#line 14
65
"Parser.cpp"
break
;
case
3
:
/* TopDef: FunDef */
#line 21
2
"Grammar.y"
#line 21
4
"Grammar.y"
{
(
yyval
.
topdef_
)
=
new
FnDef
((
yyvsp
[
0
].
fundef_
));
}
#line 14
80
"Parser.cpp"
#line 14
71
"Parser.cpp"
break
;
case
4
:
/* TopDef: ClassDef */
#line 21
3
"Grammar.y"
#line 21
5
"Grammar.y"
{
(
yyval
.
topdef_
)
=
new
ClDef
((
yyvsp
[
0
].
classdef_
));
}
#line 14
86
"Parser.cpp"
#line 14
77
"Parser.cpp"
break
;
case
5
:
/* ListTopDef: TopDef */
#line 21
5
"Grammar.y"
#line 21
7
"Grammar.y"
{
(
yyval
.
listtopdef_
)
=
new
ListTopDef
()
;
(
yyval
.
listtopdef_
)
->
push_back
((
yyvsp
[
0
].
topdef_
));
}
#line 14
92
"Parser.cpp"
#line 14
83
"Parser.cpp"
break
;
case
6
:
/* ListTopDef: TopDef ListTopDef */
#line 21
6
"Grammar.y"
#line 21
8
"Grammar.y"
{
(
yyvsp
[
0
].
listtopdef_
)
->
push_back
((
yyvsp
[
-
1
].
topdef_
))
;
(
yyval
.
listtopdef_
)
=
(
yyvsp
[
0
].
listtopdef_
)
;
}
#line 14
98
"Parser.cpp"
#line 14
89
"Parser.cpp"
break
;
case
7
:
/* FunDef: Type PIdent _SYMB_0 ListArg _SYMB_1 Block */
#line 2
18
"Grammar.y"
#line 2
20
"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 1
504
"Parser.cpp"
#line 1
495
"Parser.cpp"
break
;
case
8
:
/* Arg: Type PIdent */
#line 22
0
"Grammar.y"
#line 22
2
"Grammar.y"
{
(
yyval
.
arg_
)
=
new
Ar
((
yyvsp
[
-
1
].
type_
),
(
yyvsp
[
0
].
pident_
));
}
#line 15
10
"Parser.cpp"
#line 15
01
"Parser.cpp"
break
;
case
9
:
/* ListArg: %empty */
#line 22
2
"Grammar.y"
#line 22
4
"Grammar.y"
{
(
yyval
.
listarg_
)
=
new
ListArg
();
}
#line 15
16
"Parser.cpp"
#line 15
07
"Parser.cpp"
break
;
case
10
:
/* ListArg: Arg */
#line 22
3
"Grammar.y"
#line 22
5
"Grammar.y"
{
(
yyval
.
listarg_
)
=
new
ListArg
()
;
(
yyval
.
listarg_
)
->
push_back
((
yyvsp
[
0
].
arg_
));
}
#line 15
22
"Parser.cpp"
#line 15
13
"Parser.cpp"
break
;
case
11
:
/* ListArg: Arg _SYMB_2 ListArg */
#line 22
4
"Grammar.y"
#line 22
6
"Grammar.y"
{
(
yyvsp
[
0
].
listarg_
)
->
push_back
((
yyvsp
[
-
2
].
arg_
))
;
(
yyval
.
listarg_
)
=
(
yyvsp
[
0
].
listarg_
)
;
}
#line 15
28
"Parser.cpp"
#line 15
19
"Parser.cpp"
break
;
case
12
:
/* ClassDef: _SYMB_2
8
PIdent ClassBlock */
#line 22
6
"Grammar.y"
case
12
:
/* ClassDef: _SYMB_2
9
PIdent ClassBlock */
#line 22
8
"Grammar.y"
{
(
yyval
.
classdef_
)
=
new
ClassDefN
((
yyvsp
[
-
1
].
pident_
),
(
yyvsp
[
0
].
classblock_
));
}
#line 15
34
"Parser.cpp"
#line 15
25
"Parser.cpp"
break
;
case
13
:
/* ClassDef: _SYMB_2
8 PIdent _SYMB_30
PIdent ClassBlock */
#line 22
7
"Grammar.y"
case
13
:
/* ClassDef: _SYMB_2
9 PIdent _SYMB_31
PIdent ClassBlock */
#line 22
9
"Grammar.y"
{
(
yyval
.
classdef_
)
=
new
ClassDefE
((
yyvsp
[
-
3
].
pident_
),
(
yyvsp
[
-
1
].
pident_
),
(
yyvsp
[
0
].
classblock_
));
}
#line 15
40
"Parser.cpp"
#line 15
31
"Parser.cpp"
break
;
case
14
:
/* ClassBlock: _SYMB_3 ListClassBlockDef _SYMB_4 */
#line 2
29
"Grammar.y"
#line 2
31
"Grammar.y"
{
(
yyval
.
classblock_
)
=
new
ClassBl
((
yyvsp
[
-
1
].
listclassblockdef_
));
}
#line 15
46
"Parser.cpp"
#line 15
37
"Parser.cpp"
break
;
case
15
:
/* ClassBlockDef: FunDef */
#line 23
1
"Grammar.y"
#line 23
3
"Grammar.y"
{
(
yyval
.
classblockdef_
)
=
new
ClassMthd
((
yyvsp
[
0
].
fundef_
));
}
#line 15
52
"Parser.cpp"
#line 15
43
"Parser.cpp"
break
;
case
16
:
/* ClassBlockDef: Type ListItem _SYMB_5 */
#line 23
2
"Grammar.y"
#line 23
4
"Grammar.y"
{
std
::
reverse
((
yyvsp
[
-
1
].
listitem_
)
->
begin
(),(
yyvsp
[
-
1
].
listitem_
)
->
end
())
;(
yyval
.
classblockdef_
)
=
new
ClassFld
((
yyvsp
[
-
2
].
type_
),
(
yyvsp
[
-
1
].
listitem_
));
}
#line 15
58
"Parser.cpp"
#line 15
49
"Parser.cpp"
break
;
case
17
:
/* ListClassBlockDef: %empty */
#line 23
4
"Grammar.y"
#line 23
6
"Grammar.y"
{
(
yyval
.
listclassblockdef_
)
=
new
ListClassBlockDef
();
}
#line 15
64
"Parser.cpp"
#line 15
55
"Parser.cpp"
break
;
case
18
:
/* ListClassBlockDef: ListClassBlockDef ClassBlockDef */
#line 23
5
"Grammar.y"
#line 23
7
"Grammar.y"
{
(
yyvsp
[
-
1
].
listclassblockdef_
)
->
push_back
((
yyvsp
[
0
].
classblockdef_
))
;
(
yyval
.
listclassblockdef_
)
=
(
yyvsp
[
-
1
].
listclassblockdef_
)
;
}
#line 15
70
"Parser.cpp"
#line 15
61
"Parser.cpp"
break
;
case
19
:
/* Block: _SYMB_3 ListStmt _SYMB_4 */
#line 23
7
"Grammar.y"
#line 23
9
"Grammar.y"
{
(
yyval
.
block_
)
=
new
Blk
((
yyvsp
[
-
1
].
liststmt_
));
}
#line 15
76
"Parser.cpp"
#line 15
67
"Parser.cpp"
break
;
case
20
:
/* ListStmt: %empty */
#line 2
39
"Grammar.y"
#line 2
41
"Grammar.y"
{
(
yyval
.
liststmt_
)
=
new
ListStmt
();
}
#line 15
82
"Parser.cpp"
#line 15
73
"Parser.cpp"
break
;
case
21
:
/* ListStmt: ListStmt Stmt */
#line 24
0
"Grammar.y"
#line 24
2
"Grammar.y"
{
(
yyvsp
[
-
1
].
liststmt_
)
->
push_back
((
yyvsp
[
0
].
stmt_
))
;
(
yyval
.
liststmt_
)
=
(
yyvsp
[
-
1
].
liststmt_
)
;
}
#line 15
88
"Parser.cpp"
#line 15
79
"Parser.cpp"
break
;
case
22
:
/* Stmt: _SYMB_5 */
#line 24
2
"Grammar.y"
#line 24
4
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
Empty
();
}
#line 15
94
"Parser.cpp"
#line 15
85
"Parser.cpp"
break
;
case
23
:
/* Stmt: Block */
#line 24
3
"Grammar.y"
#line 24
5
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
BStmt
((
yyvsp
[
0
].
block_
));
}
#line 1
600
"Parser.cpp"
#line 1
591
"Parser.cpp"
break
;
case
24
:
/* Stmt: Type ListItem _SYMB_5 */
#line 24
4
"Grammar.y"
#line 24
6
"Grammar.y"
{
std
::
reverse
((
yyvsp
[
-
1
].
listitem_
)
->
begin
(),(
yyvsp
[
-
1
].
listitem_
)
->
end
())
;(
yyval
.
stmt_
)
=
new
Decl
((
yyvsp
[
-
2
].
type_
),
(
yyvsp
[
-
1
].
listitem_
));
}
#line 1
606
"Parser.cpp"
#line 1
597
"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 16
24
"Parser.cpp"
{
(
yyval
.
stmt_
)
=
new
Ass
((
yyvsp
[
-
3
].
expr_
),
(
yyvsp
[
-
1
].
expr_
));
}
#line 16
03
"Parser.cpp"
break
;
case
2
8
:
/* Stmt: PIdent _SYMB_7 Expr _SYMB_8 _SYMB_10
_SYMB_5 */
case
2
6
:
/* Stmt: Expr _SYMB_7
_SYMB_5 */
#line 248 "Grammar.y"
{
(
yyval
.
stmt_
)
=
new
TableDecr
((
yyvsp
[
-
5
].
pident_
),
(
yyvsp
[
-
3
].
expr_
));
}
#line 16
30
"Parser.cpp"
{
(
yyval
.
stmt_
)
=
new
Incr
((
yyvsp
[
-
2
].
expr_
));
}
#line 16
09
"Parser.cpp"
break
;
case
2
9
:
/* Stmt: PIdent _SYMB_9
_SYMB_5 */
case
2
7
:
/* Stmt: Expr _SYMB_8
_SYMB_5 */
#line 249 "Grammar.y"
{
(
yyval
.
stmt_
)
=
new
Incr
((
yyvsp
[
-
2
].
pident
_
));
}
#line 16
36
"Parser.cpp"
{
(
yyval
.
stmt_
)
=
new
Decr
((
yyvsp
[
-
2
].
expr
_
));
}
#line 16
15
"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 16
48
"Parser.cpp"
#line 16
21
"Parser.cpp"
break
;
case
32
:
/* Stmt: _SYMB_37
_SYMB_5 */
#line 25
2
"Grammar.y"
case
29
:
/* Stmt: _SYMB_38
_SYMB_5 */
#line 25
1
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
VRet
();
}
#line 16
54
"Parser.cpp"
#line 16
27
"Parser.cpp"
break
;
case
3
3
:
/* Stmt: _SYMB_33
_SYMB_0 Expr _SYMB_1 Stmt */
#line 25
3
"Grammar.y"
case
3
0
:
/* Stmt: _SYMB_34
_SYMB_0 Expr _SYMB_1 Stmt */
#line 25
2
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
Cond
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
0
].
stmt_
));
}
#line 16
60
"Parser.cpp"
#line 16
33
"Parser.cpp"
break
;
case
3
4
:
/* Stmt: _SYMB_33 _SYMB_0 Expr _SYMB_1 Stmt _SYMB_29
Stmt */
#line 25
4
"Grammar.y"
case
3
1
:
/* Stmt: _SYMB_34 _SYMB_0 Expr _SYMB_1 Stmt _SYMB_30
Stmt */
#line 25
3
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
CondElse
((
yyvsp
[
-
4
].
expr_
),
(
yyvsp
[
-
2
].
stmt_
),
(
yyvsp
[
0
].
stmt_
));
}
#line 16
66
"Parser.cpp"
#line 16
39
"Parser.cpp"
break
;
case
3
5
:
/* Stmt: _SYMB_41
_SYMB_0 Expr _SYMB_1 Stmt */
#line 25
5
"Grammar.y"
case
3
2
:
/* Stmt: _SYMB_42
_SYMB_0 Expr _SYMB_1 Stmt */
#line 25
4
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
While
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
0
].
stmt_
));
}
#line 16
72
"Parser.cpp"
#line 16
45
"Parser.cpp"
break
;
case
3
6
:
/* Stmt: Expr _SYMB_5 */
#line 25
6
"Grammar.y"
case
3
3
:
/* Stmt: Expr _SYMB_5 */
#line 25
5
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
SExp
((
yyvsp
[
-
1
].
expr_
));
}
#line 16
78
"Parser.cpp"
#line 16
51
"Parser.cpp"
break
;
case
3
7
:
/* Stmt: _SYMB_32 _SYMB_0 Type PIdent _SYMB_11
Expr _SYMB_1 Stmt */
#line 25
7
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
ForEach
((
yyvsp
[
-
5
].
type_
),
(
yyvsp
[
-
4
].
pident_
),
(
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
0
].
stmt_
));
}
#line 16
84
"Parser.cpp"
case
3
4
:
/* Stmt: _SYMB_33 _SYMB_0 Type PIdent _SYMB_9
Expr _SYMB_1 Stmt */
#line 25
6
"Grammar.y"
{
(
yyval
.
stmt_
)
=
new
ForEach
((
yyvsp
[
-
5
].
type_
),
(
yyvsp
[
-
4
].
pident_
),
(
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
0
].
stmt_
));
}
#line 16
57
"Parser.cpp"
break
;
case
3
8
:
/* Item: PIdent */
#line 25
9
"Grammar.y"
case
3
5
:
/* Item: PIdent */
#line 25
8
"Grammar.y"
{
(
yyval
.
item_
)
=
new
NoInit
((
yyvsp
[
0
].
pident_
));
}
#line 16
90
"Parser.cpp"
#line 16
63
"Parser.cpp"
break
;
case
3
9
:
/* Item: PIdent _SYMB_6 Expr */
#line 2
60
"Grammar.y"
case
3
6
:
/* Item: PIdent _SYMB_6 Expr */
#line 2
59
"Grammar.y"
{
(
yyval
.
item_
)
=
new
Init
((
yyvsp
[
-
2
].
pident_
),
(
yyvsp
[
0
].
expr_
));
}
#line 16
96
"Parser.cpp"
#line 16
69
"Parser.cpp"
break
;
case
40
:
/* ListItem: Item */
#line 26
2
"Grammar.y"
case
37
:
/* ListItem: Item */
#line 26
1
"Grammar.y"
{
(
yyval
.
listitem_
)
=
new
ListItem
()
;
(
yyval
.
listitem_
)
->
push_back
((
yyvsp
[
0
].
item_
));
}
#line 1
702
"Parser.cpp"
#line 1
675
"Parser.cpp"
break
;
case
41
:
/* ListItem: Item _SYMB_2 ListItem */
#line 26
3
"Grammar.y"
case
38
:
/* ListItem: Item _SYMB_2 ListItem */
#line 26
2
"Grammar.y"
{
(
yyvsp
[
0
].
listitem_
)
->
push_back
((
yyvsp
[
-
2
].
item_
))
;
(
yyval
.
listitem_
)
=
(
yyvsp
[
0
].
listitem_
)
;
}
#line 1
708
"Parser.cpp"
#line 1
681
"Parser.cpp"
break
;
case
42
:
/* Type: _SYMB_34
*/
#line 26
5
"Grammar.y"
case
39
:
/* Type: _SYMB_35
*/
#line 26
4
"Grammar.y"
{
(
yyval
.
type_
)
=
new
Int
();
}
#line 1
714
"Parser.cpp"
#line 1
687
"Parser.cpp"
break
;
case
4
3
:
/* Type: _SYMB_38
*/
#line 26
6
"Grammar.y"
case
4
0
:
/* Type: _SYMB_39
*/
#line 26
5
"Grammar.y"
{
(
yyval
.
type_
)
=
new
Str
();
}
#line 1
720
"Parser.cpp"
#line 1
693
"Parser.cpp"
break
;
case
4
4
:
/* Type: _SYMB_27
*/
#line 26
7
"Grammar.y"
case
4
1
:
/* Type: _SYMB_28
*/
#line 26
6
"Grammar.y"
{
(
yyval
.
type_
)
=
new
Bool
();
}
#line 1
726
"Parser.cpp"
#line 1
699
"Parser.cpp"
break
;
case
4
5
:
/* Type: _SYMB_40
*/
#line 26
8
"Grammar.y"
case
4
2
:
/* Type: _SYMB_41
*/
#line 26
7
"Grammar.y"
{
(
yyval
.
type_
)
=
new
Void
();
}
#line 17
32
"Parser.cpp"
#line 17
05
"Parser.cpp"
break
;
case
4
6
:
/* Type: Type _SYMB_7 _SYMB_8
*/
#line 26
9
"Grammar.y"
{
(
yyval
.
type_
)
=
new
Array
((
yyvsp
[
-
2
].
type_
));
}
#line 17
38
"Parser.cpp"
case
4
3
:
/* Type: Type _SYMB_10
*/
#line 26
8
"Grammar.y"
{
(
yyval
.
type_
)
=
new
Array
((
yyvsp
[
-
1
].
type_
));
}
#line 17
11
"Parser.cpp"
break
;
case
4
7
:
/* Type: PIdent */
#line 2
70
"Grammar.y"
case
4
4
:
/* Type: PIdent */
#line 2
69
"Grammar.y"
{
(
yyval
.
type_
)
=
new
ClassT
((
yyvsp
[
0
].
pident_
));
}
#line 17
44
"Parser.cpp"
#line 17
17
"Parser.cpp"
break
;
case
4
8
:
/* Expr6
: PIdent */
#line 27
6
"Grammar.y"
case
4
5
:
/* Expr7
: PIdent */
#line 27
5
"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
4
9
:
/* Expr6: _INTEGER_
*/
case
4
7
:
/* Expr7: Expr7 _SYMB_13 PIdent
*/
#line 277 "Grammar.y"
{
(
yyval
.
expr_
)
=
new
ELitInt
((
yyvsp
[
0
].
i
nt_
));
}
#line 17
56
"Parser.cpp"
{
(
yyval
.
expr_
)
=
new
EClsMmbr
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
0
].
pide
nt_
));
}
#line 17
35
"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 17
62
"Parser.cpp"
{
std
::
reverse
((
yyvsp
[
-
1
].
listexpr_
)
->
begin
(),(
yyvsp
[
-
1
].
listexpr_
)
->
end
())
;(
yyval
.
expr_
)
=
new
EApp
((
yyvsp
[
-
3
].
expr_
),
(
yyvsp
[
-
1
].
listexpr_
)
);
}
#line 17
41
"Parser.cpp"
break
;
case
51
:
/* Expr6: _SYMB_3
1 */
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
5
3
:
/* Expr6: _STRING
_ */
case
5
0
:
/* Expr6: _INTEGER
_ */
#line 281 "Grammar.y"
{
(
yyval
.
expr_
)
=
new
EString
((
yyvsp
[
0
].
string
_
));
}
#line 17
80
"Parser.cpp"
{
(
yyval
.
expr_
)
=
new
ELitInt
((
yyvsp
[
0
].
int
_
));
}
#line 17
53
"Parser.cpp"
break
;
case
5
4
:
/* Expr6: _SYMB_35 Type _SYMB_7 Expr _SYMB_8
*/
case
5
1
:
/* Expr6: _SYMB_40
*/
#line 282 "Grammar.y"
{
(
yyval
.
expr_
)
=
new
ENewArray
((
yyvsp
[
-
3
].
type_
),
(
yyvsp
[
-
1
].
expr_
)
);
}
#line 17
86
"Parser.cpp"
{
(
yyval
.
expr_
)
=
new
ELitTrue
(
);
}
#line 17
59
"Parser.cpp"
break
;
case
5
5
:
/* Expr6: _SYMB_35 PIdent
*/
case
5
2
:
/* Expr6: _SYMB_32
*/
#line 283 "Grammar.y"
{
(
yyval
.
expr_
)
=
new
ENewClass
((
yyvsp
[
0
].
pident_
)
);
}
#line 17
92
"Parser.cpp"
{
(
yyval
.
expr_
)
=
new
ELitFalse
(
);
}
#line 17
65
"Parser.cpp"
break
;
case
5
6
:
/* Expr6: Expr6 _SYMB_12 PIdent
*/
case
5
3
:
/* Expr6: _STRING_
*/
#line 284 "Grammar.y"
{
(
yyval
.
expr_
)
=
new
EClsMmbr
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
0
].
pident
_
));
}
#line 17
98
"Parser.cpp"
{
(
yyval
.
expr_
)
=
new
EString
((
yyvsp
[
0
].
string
_
));
}
#line 17
71
"Parser.cpp"
break
;
case
5
7
:
/* Expr6: Expr6 _SYMB_12 PIdent _SYMB_0 ListExpr _SYMB_1
*/
case
5
4
:
/* 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
].
list
expr_
));
}
#line 1
804
"Parser.cpp"
{
(
yyval
.
expr_
)
=
new
ENewArray
((
yyvsp
[
-
3
].
type_
),
(
yyvsp
[
-
1
].
expr_
));
}
#line 1
777
"Parser.cpp"
break
;
case
5
8
:
/* Expr6: _SYMB_36
*/
case
5
5
:
/* Expr6: _SYMB_36 PIdent
*/
#line 286 "Grammar.y"
{
(
yyval
.
expr_
)
=
new
Null
(
);
}
#line 1
810
"Parser.cpp"
{
(
yyval
.
expr_
)
=
new
ENewClass
((
yyvsp
[
0
].
pident_
)
);
}
#line 1
783
"Parser.cpp"
break
;
case
5
9
:
/* Expr6: PIdent _SYMB_7 Expr _SYMB_8
*/
case
5
6
:
/* Expr6: Expr7
*/
#line 287 "Grammar.y"
{
(
yyval
.
expr_
)
=
new
EIndexAcc
((
yyvsp
[
-
3
].
pident_
),
(
yyvsp
[
-
1
].
expr_
)
);
}
#line 1
816
"Parser.cpp"
{
(
yyval
.
expr_
)
=
(
yyvsp
[
0
].
expr_
);
}
#line 1
789
"Parser.cpp"
break
;
case
60
:
/* Expr6: _SYMB_0 Expr _SYMB_1
*/
#line 28
8
"Grammar.y"
{
(
yyval
.
expr_
)
=
(
yyvsp
[
-
1
].
expr_
);
}
#line 1
822
"Parser.cpp"
case
57
:
/* Expr5: _SYMB_0 Expr _SYMB_1 _SYMB_37
*/
#line 28
9
"Grammar.y"
{
(
yyval
.
expr_
)
=
new
NullCast
((
yyvsp
[
-
2
].
expr_
)
);
}
#line 1
795
"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 18
34
"Parser.cpp"
#line 18
01
"Parser.cpp"
break
;
case
63
:
/* Expr5: _SYMB_14
Expr6 */
#line 29
2
"Grammar.y"
case
59
:
/* Expr5: _SYMB_15
Expr6 */
#line 29
1
"Grammar.y"
{
(
yyval
.
expr_
)
=
new
Not
((
yyvsp
[
0
].
expr_
));
}
#line 18
40
"Parser.cpp"
#line 18
07
"Parser.cpp"
break
;
case
6
4
:
/* Expr5: Expr6 */
#line 29
3
"Grammar.y"
case
6
0
:
/* Expr5: Expr6 */
#line 29
2
"Grammar.y"
{
(
yyval
.
expr_
)
=
(
yyvsp
[
0
].
expr_
);
}
#line 18
46
"Parser.cpp"
#line 18
13
"Parser.cpp"
break
;
case
6
5
:
/* Expr4: Expr4 MulOp Expr5 */
#line 29
5
"Grammar.y"
case
6
1
:
/* Expr4: Expr4 MulOp Expr5 */
#line 29
4
"Grammar.y"
{
(
yyval
.
expr_
)
=
new
EMul
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
-
1
].
mulop_
),
(
yyvsp
[
0
].
expr_
));
}
#line 18
52
"Parser.cpp"
#line 18
19
"Parser.cpp"
break
;
case
6
6
:
/* Expr4: Expr5 */
#line 29
6
"Grammar.y"
case
6
2
:
/* Expr4: Expr5 */
#line 29
5
"Grammar.y"
{
(
yyval
.
expr_
)
=
(
yyvsp
[
0
].
expr_
);
}
#line 18
58
"Parser.cpp"
#line 18
25
"Parser.cpp"
break
;
case
6
7
:
/* Expr3: Expr3 AddOp Expr4 */
#line 29
8
"Grammar.y"
case
6
3
:
/* Expr3: Expr3 AddOp Expr4 */
#line 29
7
"Grammar.y"
{
(
yyval
.
expr_
)
=
new
EAdd
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
-
1
].
addop_
),
(
yyvsp
[
0
].
expr_
));
}
#line 18
64
"Parser.cpp"
#line 18
31
"Parser.cpp"
break
;
case
6
8
:
/* Expr3: Expr4 */
#line 29
9
"Grammar.y"
case
6
4
:
/* Expr3: Expr4 */
#line 29
8
"Grammar.y"
{
(
yyval
.
expr_
)
=
(
yyvsp
[
0
].
expr_
);
}
#line 18
70
"Parser.cpp"
#line 18
37
"Parser.cpp"
break
;
case
6
9
:
/* Expr2: Expr2 RelOp Expr3 */
#line 30
1
"Grammar.y"
case
6
5
:
/* Expr2: Expr2 RelOp Expr3 */
#line 30
0
"Grammar.y"
{
(
yyval
.
expr_
)
=
new
ERel
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
-
1
].
relop_
),
(
yyvsp
[
0
].
expr_
));
}
#line 18
76
"Parser.cpp"
#line 18
43
"Parser.cpp"
break
;
case
70
:
/* Expr2: Expr3 */
#line 30
2
"Grammar.y"
case
66
:
/* Expr2: Expr3 */
#line 30
1
"Grammar.y"
{
(
yyval
.
expr_
)
=
(
yyvsp
[
0
].
expr_
);
}
#line 18
82
"Parser.cpp"
#line 18
49
"Parser.cpp"
break
;
case
71
:
/* Expr1: Expr2 _SYMB_15
Expr1 */
#line 30
4
"Grammar.y"
case
67
:
/* Expr1: Expr2 _SYMB_16
Expr1 */
#line 30
3
"Grammar.y"
{
(
yyval
.
expr_
)
=
new
EAnd
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
0
].
expr_
));
}
#line 18
88
"Parser.cpp"
#line 18
55
"Parser.cpp"
break
;
case
72
:
/* Expr1: Expr2 */
#line 30
5
"Grammar.y"
case
68
:
/* Expr1: Expr2 */
#line 30
4
"Grammar.y"
{
(
yyval
.
expr_
)
=
(
yyvsp
[
0
].
expr_
);
}
#line 18
94
"Parser.cpp"
#line 18
61
"Parser.cpp"
break
;
case
73
:
/* Expr: Expr1 _SYMB_16
Expr */
#line 30
7
"Grammar.y"
case
69
:
/* Expr: Expr1 _SYMB_17
Expr */
#line 30
6
"Grammar.y"
{
(
yyval
.
expr_
)
=
new
EOr
((
yyvsp
[
-
2
].
expr_
),
(
yyvsp
[
0
].
expr_
));
}
#line 1
900
"Parser.cpp"
#line 1
867
"Parser.cpp"
break
;
case
7
4
:
/* Expr: Expr1 */
#line 30
8
"Grammar.y"
case
7
0
:
/* Expr: Expr1 */
#line 30
7
"Grammar.y"
{
(
yyval
.
expr_
)
=
(
yyvsp
[
0
].
expr_
);
}
#line 1
906
"Parser.cpp"
#line 1
873
"Parser.cpp"
break
;
case
7
5
:
/* ListExpr: %empty */
#line 3
10
"Grammar.y"
case
7
1
:
/* ListExpr: %empty */
#line 3
09
"Grammar.y"
{
(
yyval
.
listexpr_
)
=
new
ListExpr
();
}
#line 1
912
"Parser.cpp"
#line 1
879
"Parser.cpp"
break
;
case
7
6
:
/* ListExpr: Expr */
#line 31
1
"Grammar.y"
case
7
2
:
/* ListExpr: Expr */
#line 31
0
"Grammar.y"
{
(
yyval
.
listexpr_
)
=
new
ListExpr
()
;
(
yyval
.
listexpr_
)
->
push_back
((
yyvsp
[
0
].
expr_
));
}
#line 1
918
"Parser.cpp"
#line 1
885
"Parser.cpp"
break
;
case
7
7
:
/* ListExpr: Expr _SYMB_2 ListExpr */
#line 31
2
"Grammar.y"
case
7
3
:
/* ListExpr: Expr _SYMB_2 ListExpr */
#line 31
1
"Grammar.y"
{
(
yyvsp
[
0
].
listexpr_
)
->
push_back
((
yyvsp
[
-
2
].
expr_
))
;
(
yyval
.
listexpr_
)
=
(
yyvsp
[
0
].
listexpr_
)
;
}
#line 1
924
"Parser.cpp"
#line 1
891
"Parser.cpp"
break
;
case
7
8
:
/* AddOp: _SYMB_17
*/
#line 31
4
"Grammar.y"
case
7
4
:
/* AddOp: _SYMB_18
*/
#line 31
3
"Grammar.y"
{
(
yyval
.
addop_
)
=
new
Plus
();
}
#line 1
930
"Parser.cpp"
#line 1
897
"Parser.cpp"
break
;
case
7
9
:
/* AddOp: _SYMB_13
*/
#line 31
5
"Grammar.y"
case
7
5
:
/* AddOp: _SYMB_14
*/
#line 31
4
"Grammar.y"
{
(
yyval
.
addop_
)
=
new
Minus
();
}
#line 19
36
"Parser.cpp"
#line 19
03
"Parser.cpp"
break
;
case
80
:
/* MulOp: _SYMB_18
*/
#line 31
7
"Grammar.y"
case
76
:
/* MulOp: _SYMB_19
*/
#line 31
6
"Grammar.y"
{
(
yyval
.
mulop_
)
=
new
Times
();
}
#line 19
42
"Parser.cpp"
#line 19
09
"Parser.cpp"
break
;
case
81
:
/* MulOp: _SYMB_19
*/
#line 31
8
"Grammar.y"
case
77
:
/* MulOp: _SYMB_20
*/
#line 31
7
"Grammar.y"
{
(
yyval
.
mulop_
)
=
new
Div
();
}
#line 19
48
"Parser.cpp"
#line 19
15
"Parser.cpp"
break
;
case
82
:
/* MulOp: _SYMB_20
*/
#line 31
9
"Grammar.y"
case
78
:
/* MulOp: _SYMB_21
*/
#line 31
8
"Grammar.y"
{
(
yyval
.
mulop_
)
=
new
Mod
();
}
#line 19
54
"Parser.cpp"
#line 19
21
"Parser.cpp"
break
;
case
83
:
/* RelOp: _SYMB_21
*/
#line 32
1
"Grammar.y"
case
79
:
/* RelOp: _SYMB_22
*/
#line 32
0
"Grammar.y"
{
(
yyval
.
relop_
)
=
new
LTH
();
}
#line 19
60
"Parser.cpp"
#line 19
27
"Parser.cpp"
break
;
case
8
4
:
/* RelOp: _SYMB_22
*/
#line 32
2
"Grammar.y"
case
8
0
:
/* RelOp: _SYMB_23
*/
#line 32
1
"Grammar.y"
{
(
yyval
.
relop_
)
=
new
LE
();
}
#line 19
66
"Parser.cpp"
#line 19
33
"Parser.cpp"
break
;
case
8
5
:
/* RelOp: _SYMB_23
*/
#line 32
3
"Grammar.y"
case
8
1
:
/* RelOp: _SYMB_24
*/
#line 32
2
"Grammar.y"
{
(
yyval
.
relop_
)
=
new
GTH
();
}
#line 19
72
"Parser.cpp"
#line 19
39
"Parser.cpp"
break
;
case
8
6
:
/* RelOp: _SYMB_24
*/
#line 32
4
"Grammar.y"
case
8
2
:
/* RelOp: _SYMB_25
*/
#line 32
3
"Grammar.y"
{
(
yyval
.
relop_
)
=
new
GE
();
}
#line 19
78
"Parser.cpp"
#line 19
45
"Parser.cpp"
break
;
case
8
7
:
/* RelOp: _SYMB_25
*/
#line 32
5
"Grammar.y"
case
8
3
:
/* RelOp: _SYMB_26
*/
#line 32
4
"Grammar.y"
{
(
yyval
.
relop_
)
=
new
EQU
();
}
#line 19
84
"Parser.cpp"
#line 19
51
"Parser.cpp"
break
;
case
8
8
:
/* RelOp: _SYMB_26
*/
#line 32
6
"Grammar.y"
case
8
4
:
/* RelOp: _SYMB_27
*/
#line 32
5
"Grammar.y"
{
(
yyval
.
relop_
)
=
new
NE
();
}
#line 19
90
"Parser.cpp"
#line 19
57
"Parser.cpp"
break
;
case
8
9
:
/* PIdent: _SYMB_42
*/
#line 32
8
"Grammar.y"
case
8
5
:
/* PIdent: _SYMB_43
*/
#line 32
7
"Grammar.y"
{
(
yyval
.
pident_
)
=
new
PIdent
((
yyvsp
[
0
].
string_
),
yy_mylinenumber
)
;
YY_RESULT_PIdent_
=
(
yyval
.
pident_
)
;
}
#line 19
96
"Parser.cpp"
#line 19
63
"Parser.cpp"
break
;
#line
2000
"Parser.cpp"
#line
1967
"Parser.cpp"
default:
break
;
}
...
...
Parser.h
View file @
0cd3f111
...
...
@@ -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
;
...
...
Printer.cpp
View file @
0cd3f111
...
...
@@ -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
::
visitE
LitTrue
(
ELitTrue
*
p
)
void
PrintAbsyn
::
visitE
IndexAcc
(
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
::
visitE
LitFalse
(
ELitFalse
*
p
)
void
PrintAbsyn
::
visitE
ClsMmbr
(
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
::
visitE
NewClass
(
ENewClass
*
p
)
void
PrintAbsyn
::
visitE
LitTrue
(
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
::
visitE
ClsMmbr
(
EClsMmbr
*
p
)
void
PrintAbsyn
::
visitE
LitFalse
(
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
::
visitE
ClsMthd
(
EClsMthd
*
p
)
void
PrintAbsyn
::
visitE
String
(
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
::
visit
Null
(
Null
*
p
)
void
PrintAbsyn
::
visit
ENewArray
(
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
::
visitE
IndexAcc
(
EIndexAcc
*
p
)
void
PrintAbsyn
::
visitE
NewClass
(
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
::
visit
ECast
(
E
Cast
*
p
)
void
PrintAbsyn
::
visit
NullCast
(
Null
Cast
*
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
::
visit
TableDecr
(
Table
Decr
*
p
)
void
ShowAbsyn
::
visit
Decr
(
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
(
"ForEa
c
h"
);
bufAppend
(
' '
);
bufAppend
(
'['
);
if
(
p
->
type_
)
p
->
type_
->
accept
(
this
);
...
...
@@ -1655,122 +1538,100 @@ void ShowAbsyn::visitEVar(EVar *p)
visitPIdent
(
p
->
pident_
);
bufAppend
(
')'
);
}
void
ShowAbsyn
::
visitE
LitInt
(
ELitInt
*
p
)
void
ShowAbsyn
::
visitE
IndexAcc
(
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
->
list
expr_
->
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
(
"E
NewArray
"
);
bufAppend
(
"E
App
"
);
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
->
list
expr_
->
accept
(
this
);
bufAppend
(
']'
);
bufAppend
(
' '
);
bufAppend
(
')'
);
}
void
ShowAbsyn
::
visitE
NewClass
(
ENewClass
*
p
)
void
ShowAbsyn
::
visitE
LitInt
(
ELitInt
*
p
)
{
bufAppend
(
'('
);
bufAppend
(
"E
NewClass
"
);
bufAppend
(
"E
LitInt
"
);
bufAppend
(
' '
);
visit
PIdent
(
p
->
pident
_
);
visit
Integer
(
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
(
' '
);
visit
PIdent
(
p
->
pident
_
);
visit
String
(
p
->
string
_
);
bufAppend
(
')'
);
}
void
ShowAbsyn
::
visitE
ClsMthd
(
EClsMthd
*
p
)
void
ShowAbsyn
::
visitE
NewArray
(
ENewArray
*
p
)
{
bufAppend
(
'('
);
bufAppend
(
"E
ClsMthd
"
);
bufAppend
(
"E
NewArray
"
);
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
->
list
expr_
->
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
(
"E
IndexAcc
"
);
bufAppend
(
"E
NewClass
"
);
bufAppend
(
' '
);
visitPIdent
(
p
->
pident_
);
bufAppend
(
' '
);
bufAppend
(
'['
);
if
(
p
->
expr_
)
p
->
expr_
->
accept
(
this
);
bufAppend
(
']'
);
bufAppend
(
' '
);
bufAppend
(
')'
);
}
void
ShowAbsyn
::
visit
ECast
(
E
Cast
*
p
)
void
ShowAbsyn
::
visit
NullCast
(
Null
Cast
*
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
(
"L
TH
"
);
}
void
ShowAbsyn
::
visitLE
(
LE
*
p
)
{
...
...
@@ -1900,7 +1761,7 @@ void ShowAbsyn::visitLE(LE *p)
}
void
ShowAbsyn
::
visitGTH
(
GTH
*
p
)
{
bufAppend
(
"G
.h
"
);
bufAppend
(
"G
TH
"
);
}
void
ShowAbsyn
::
visitGE
(
GE
*
p
)
{
...
...
@@ -1953,4 +1814,3 @@ void ShowAbsyn::visitPIdent(String s)
}
Printer.h
View file @
0cd3f111
...
...
@@ -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
Skeleton.cpp
View file @
0cd3f111
...
...
@@ -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 E
LitTrue
Goes Here */
/* Code For E
IndexAcc
Goes Here */
e_index_acc
->
expr_1
->
accept
(
this
);
e_index_acc
->
expr_2
->
accept
(
this
);
}
void
Skeleton
::
visitE
LitFalse
(
ELitFalse
*
e_lit_false
)
void
Skeleton
::
visitE
ClsMmbr
(
EClsMmbr
*
e_cls_mmbr
)
{
/* Code For E
LitFalse
Goes Here */
/* Code For E
ClsMmbr
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 E
NewArray
Goes Here */
/* Code For E
LitInt
Goes Here */
e_new_array
->
type_
->
accept
(
this
);
e_new_array
->
expr_
->
accept
(
this
);
visitInteger
(
e_lit_int
->
integer_
);
}
void
Skeleton
::
visitE
NewClass
(
ENewClass
*
e_new_class
)
void
Skeleton
::
visitE
LitTrue
(
ELitTrue
*
e_lit_true
)
{
/* Code For E
NewClass
Goes Here */
/* Code For E
LitTrue
Goes Here */
e_new_class
->
pident_
->
accept
(
this
);
}
void
Skeleton
::
visitE
ClsMmbr
(
EClsMmbr
*
e_cls_mmbr
)
void
Skeleton
::
visitE
LitFalse
(
ELitFalse
*
e_lit_false
)
{
/* Code For E
ClsMmbr
Goes Here */
/* Code For E
LitFalse
Goes Here */
e_cls_mmbr
->
expr_
->
accept
(
this
);
e_cls_mmbr
->
pident_
->
accept
(
this
);
}
void
Skeleton
::
visitE
ClsMthd
(
EClsMthd
*
e_cls_mthd
)
void
Skeleton
::
visitE
String
(
EString
*
e_string
)
{
/* Code For E
ClsMthd
Goes Here */
/* Code For E
String
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
::
visit
Null
(
Null
*
null
)
void
Skeleton
::
visit
ENewArray
(
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
::
visitE
IndexAcc
(
EIndexAcc
*
e_index_acc
)
void
Skeleton
::
visitE
NewClass
(
ENewClass
*
e_new_class
)
{
/* Code For E
IndexAcc
Goes Here */
/* Code For E
NewClass
Goes Here */
e_index_acc
->
pident_
->
accept
(
this
);
e_index_acc
->
expr_
->
accept
(
this
);
e_new_class
->
pident_
->
accept
(
this
);
}
void
Skeleton
::
visit
ECast
(
ECast
*
e
_cast
)
void
Skeleton
::
visit
NullCast
(
NullCast
*
null
_cast
)
{
/* Code For
E
Cast Goes Here */
/* Code For
Null
Cast 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)
}
Skeleton.h
View file @
0cd3f111
...
...
@@ -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
TypeCheck.cpp
View file @
0cd3f111
...
...
@@ -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
::
visit
EClsMmbr
(
EClsMmbr
*
e_cls_mmbr
)
void
TypeCheck
::
visit
NullCast
(
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
)
{
...
...
TypeCheck.h
View file @
0cd3f111
...
...
@@ -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
);
...
...
TypeDefs.h
View file @
0cd3f111
...
...
@@ -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
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment