Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs444
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xun Yang
cs444
Commits
d409c920
Commit
d409c920
authored
5 years ago
by
pycsham
Browse files
Options
Downloads
Patches
Plain Diff
uncommented all print statements for easier debugging
parent
9863c4ef
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
AstBuilding.py
+7
-7
7 additions, 7 deletions
AstBuilding.py
Environment.py
+1
-1
1 addition, 1 deletion
Environment.py
Test.py
+9
-9
9 additions, 9 deletions
Test.py
joosc.py
+0
-1
0 additions, 1 deletion
joosc.py
with
17 additions
and
18 deletions
AstBuilding.py
+
7
−
7
View file @
d409c920
...
@@ -17,27 +17,27 @@ def buildEnvAndLink(ASTs):
...
@@ -17,27 +17,27 @@ def buildEnvAndLink(ASTs):
for
t
in
ASTs
:
for
t
in
ASTs
:
globalEnv
.
addtoEnv
(
t
[
1
])
globalEnv
.
addtoEnv
(
t
[
1
])
print
(
"
\n\n
###################### global Env ####################
"
)
#
print ("\n\n###################### global Env ####################")
pprint
(
vars
(
globalEnv
))
#
pprint(vars(globalEnv))
for
t
in
ASTs
:
for
t
in
ASTs
:
try
:
try
:
t
[
1
].
recurseBuildEnv
(
globalEnv
)
t
[
1
].
recurseBuildEnv
(
globalEnv
)
except
Exception
as
e
:
# to handle double local variable declaration
except
Exception
as
e
:
# to handle double local variable declaration
raise
e
raise
e
print
(
'
\n\n\n
'
,
t
[
0
])
#
print('\n\n\n', t[0])
print
(
"
###################### Comp Unit Env ####################
"
)
#
print("###################### Comp Unit Env ####################")
t
[
1
].
recurseAction
(
"
printEnv
"
)
#
t[1].recurseAction("printEnv")
# type Linking
# type Linking
print
(
'
--------->>> type linking time!
'
)
#
print('--------->>> type linking time!')
for
t
in
ASTs
:
for
t
in
ASTs
:
# t[1].buildEnvFromImports(globalEnv)
# t[1].buildEnvFromImports(globalEnv)
t
[
1
].
recurseAction
(
"
linkType
"
)
t
[
1
].
recurseAction
(
"
linkType
"
)
# hierarchy checking
# hierarchy checking
print
(
'
--------->>> hierarchy checking time!
'
)
#
print('--------->>> hierarchy checking time!')
for
t
in
ASTs
:
for
t
in
ASTs
:
# t[1].buildEnvFromImports(globalEnv)
# t[1].buildEnvFromImports(globalEnv)
t
[
1
].
recurseAction
(
"
checkHierarchy
"
)
t
[
1
].
recurseAction
(
"
checkHierarchy
"
)
...
...
This diff is collapsed.
Click to expand it.
Environment.py
+
1
−
1
View file @
d409c920
...
@@ -105,7 +105,7 @@ class GlobalEnv(Env):
...
@@ -105,7 +105,7 @@ class GlobalEnv(Env):
return
self
.
map
.
get
(
name
)
return
self
.
map
.
get
(
name
)
# 3. type in the current package
# 3. type in the current package
full
=
packageName
+
'
.
'
+
name
full
=
packageName
+
'
.
'
+
name
print
(
full
)
#
print(full)
if
full
in
self
.
map
:
if
full
in
self
.
map
:
return
self
.
map
.
get
(
full
)
return
self
.
map
.
get
(
full
)
# 4. import-on-demand
# 4. import-on-demand
...
...
This diff is collapsed.
Click to expand it.
Test.py
+
9
−
9
View file @
d409c920
...
@@ -67,10 +67,10 @@ def run(testFiles):
...
@@ -67,10 +67,10 @@ def run(testFiles):
print
(
"
**********************************************************
"
)
print
(
"
**********************************************************
"
)
continue
continue
s
=
"
All Tokens:
"
#
s = "All Tokens: "
for
token
in
tokens
:
#
for token in tokens:
if
(
token
.
name
and
token
.
lex
):
#
if (token.name and token.lex):
s
+=
'
(
'
+
token
.
name
+
'
,
'
+
token
.
lex
+
'
),
'
#
s += '(' + token.name + ',' + token.lex + '), '
# print(s)
# print(s)
# Weeding after scanning
# Weeding after scanning
...
@@ -120,11 +120,11 @@ def run(testFiles):
...
@@ -120,11 +120,11 @@ def run(testFiles):
return
return
print
(
"
<<<<------- after buildEnvAndLink -------->>>>>>
"
)
print
(
"
<<<<------- after buildEnvAndLink -------->>>>>>
"
)
for
(
n
,
t
)
in
ASTs
:
#
for (n, t) in ASTs:
print
(
n
)
#
print(n)
print
(
"
--------------------
"
)
#
print("--------------------")
t
.
printTree
()
#
t.printTree()
print
(
"
\n
\n\n
\n
"
)
#
print("\n \n\n \n")
print
(
"
Succeeded
"
)
print
(
"
Succeeded
"
)
print
(
"
**********************************************************
"
)
print
(
"
**********************************************************
"
)
...
...
This diff is collapsed.
Click to expand it.
joosc.py
+
0
−
1
View file @
d409c920
...
@@ -43,7 +43,6 @@ def main():
...
@@ -43,7 +43,6 @@ def main():
return
42
return
42
parseTrees
.
append
((
f
,
tree
))
parseTrees
.
append
((
f
,
tree
))
print
(
tree
)
# Building ASTs from all parse trees
# Building ASTs from all parse trees
ASTs
=
astBuild
(
parseTrees
)
ASTs
=
astBuild
(
parseTrees
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment