Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Haley Sapphie Owsianko
ACC-project
Commits
fb48ab45
Commit
fb48ab45
authored
Mar 26, 2021
by
Luca Bataillard
Browse files
remove rewriteIndex, no longer needed
parent
2e2e0a17
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/src/l3/CPSValueRepresenter.scala
View file @
fb48ab45
...
...
@@ -151,12 +151,14 @@ object CPSValueRepresenter extends (H.Tree => L.Tree) {
case
L3
.
BlockSet
=>
val
block
=
rewrite
(
x
)
val
value
=
rewrite
(
z
)
rewriteIndex
(
y
)
{
idx
=>
L
.
LetP
(
n
,
CPS
.
BlockSet
,
Seq
(
block
,
idx
,
value
),
apply
(
body
))}
tempLetP
(
CPS
.
ShiftRight
,
Seq
(
Left
(
y
),
Right
(
L
.
AtomL
(
1
)))){
idx
=>
L
.
LetP
(
n
,
CPS
.
BlockSet
,
Seq
(
block
,
idx
,
value
),
apply
(
body
))
}
case
L3
.
BlockGet
=>
val
block
=
rewrite
(
x
)
rewriteIndex
(
y
){
idx
=>
L
.
LetP
(
n
,
CPS
.
BlockGet
,
Seq
(
block
,
idx
),
apply
(
body
))
}
temp
LetP
(
CPS
.
ShiftRight
,
Seq
(
Left
(
y
),
Right
(
L
.
AtomL
(
1
))
))
{
idx
=>
L
.
LetP
(
n
,
CPS
.
BlockGet
,
Seq
(
block
,
idx
),
apply
(
body
))
}
case
L3
.
ByteRead
=>
tempLetP
(
CPS
.
ByteRead
,
Seq
()){
t1
=>
tempLetP
(
CPS
.
ShiftLeft
,
Seq
(
Right
(
t1
),
lAtomOne
))
{
t2
=>
...
...
@@ -206,11 +208,4 @@ object CPSValueRepresenter extends (H.Tree => L.Tree) {
L
.
AtomL
(
0x0a
)
// 01010
case
H
.
AtomL
(
UnitLit
)
=>
L
.
AtomL
(
2
)
}
private
def
rewriteIndex
(
idx
:
H.Atom
)(
cont
:
L.Atom
=>
L
.
LetP
)
:
L.LetP
=
idx
match
{
case
H
.
AtomN
(
n
)
=>
tempLetP
(
CPS
.
ShiftRight
,
Seq
(
Left
(
idx
),
Right
(
L
.
AtomL
(
1
))))(
cont
)
case
H
.
AtomL
(
IntLit
(
i
))
=>
cont
(
L
.
AtomL
(
i
.
toInt
))
case
_
=>
throw
new
Exception
(
f
"Cannot rewrite atom {idx} which is not Name or Int Literal"
)
}
}
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