Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Job Cuppen
Advanced Programming
Commits
97aff46b
Commit
97aff46b
authored
Oct 14, 2019
by
Job Cuppen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
corrections
parent
10b552e3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
47 additions
and
166 deletions
+47
-166
week04/Clean System Files/ex1.abc
week04/Clean System Files/ex1.abc
+2
-8
week04/Clean System Files/ex1.o
week04/Clean System Files/ex1.o
+0
-0
week04/Clean System Files/ex3.abc
week04/Clean System Files/ex3.abc
+32
-151
week04/Clean System Files/ex3.o
week04/Clean System Files/ex3.o
+0
-0
week04/ex1
week04/ex1
+0
-0
week04/ex1.icl
week04/ex1.icl
+6
-1
week04/ex3
week04/ex3
+0
-0
week04/ex3.icl
week04/ex3.icl
+7
-6
No files found.
week04/Clean System Files/ex1.abc
View file @
97aff46b
...
...
@@ -23,7 +23,7 @@
.depend "StdOverloaded" "20191001141536"
.depend "StdBool" "20191001141536"
.depend "StdEnv" "20191001141536"
.module m_ex1 "ex1" "201910
07153506
"
.module m_ex1 "ex1" "201910
10135755
"
.endinfo
.impmod _system
.implab _cycle_in_spine
...
...
@@ -228,16 +228,10 @@ n21
ea21
.o 3 0
s21
buildh _Nil 0
push_a 1
buildAC "]"
buildh ARRAY 1
buildh _Cons 2
push_a 2
push_a 1
update_a 1 2
update_a 0 1
pop_a 1
build e_StdList_d++ 2 e_StdList_n++
buildh d10 0
push_a 2
push_a 1
...
...
week04/Clean System Files/ex1.o
View file @
97aff46b
No preview for this file type
week04/Clean System Files/ex3.abc
View file @
97aff46b
...
...
@@ -22,7 +22,7 @@
.depend "StdOverloaded" "20191001141536"
.depend "StdBool" "20191001141536"
.depend "StdEnv" "20191001141536"
.module m_ex3 "ex3" "201910
07152946
"
.module m_ex3 "ex3" "201910
10140318
"
.endinfo
.impmod _system
.implab _cycle_in_spine
...
...
@@ -60,174 +60,55 @@
.implab n_S.6 ea_S.6
.implab _driver
.impmod StdList
.impdesc e_StdList_d++
.implab e_StdList_n++ e_StdList_ea++
.impmod StdString
.impdesc e_StdString_dtoString;5
.implab e_StdString_ntoString;5
.implab e_StdList_sisMember;51
.impmod StdInt
.implab e_StdInt_s<;17
.desc d15 _hnf _hnf 0 0 "Leaf"
.desc d16 _hnf _add_arg 3 0 "Bin"
.record r17 aaa 3 0 "Container;"
.impdesc e_StdInt_d<;17
.impmod StdOverloaded
.impdesc e_StdOverloaded_r<;
.desc d14 _hnf _hnf 0 0 "Leaf"
.desc d15 _hnf _add_arg 3 0 "Bin"
.record r16 aaaa 4 0 "Container;"
.export __ex3_Start
.o 0 0
__ex3_Start
build _ 0 n1
.d 1 0
jmp _driver
.n 0 _
ea1
.n 0 _
.o 1 0
n1
push_node _cycle_in_spine 0
.o 1 0
.d 0 0
jsr ea1
.o 0 1 b
fillB_b 0 0
pop_b 1
.d 1 0
rtn
.o 0 0
ea1
.o
1
0
.o
0
0
s1
buildh d15 0
create
buildI 4
push_a 2
update_a 2 3
update_a 0 2
pop_a 1
.d 3 0
jsr s9
.o 1 0
create
buildh _Nil 0
buildI 3
buildh _Cons 2
buildI 2
push_a 2
update_a 2 3
update_a 0 2
pop_a 1
.d 3 0
jsr s9
.o 1 0
create
buildh _Cons 2
buildI 1
push_a 2
update_a 2 3
update_a 0 2
pop_a 1
.d 3 0
jsr s9
.o 1 0
create
buildI 3
push_a 2
update_a 2 3
update_a 0 2
pop_a 1
.d 3 0
jsr s9
.o 1 0
create
buildI 5
push_a 2
update_a 2 3
update_a 0 2
pop_a 1
.d 3 0
jsr s9
.o 1 0
.d 2 0
jmp s10
.n 1 _ ea10
.o 1 0
n10
push_node _cycle_in_spine 1
.o 2 0
ea10
jsr_eval 0
.o 2 0
s10
eq_desc d15 0 0
jmp_true case.1
jmp case.2
case.1
buildh _Nil 0
buildAC "🍁"
buildh ARRAY 1
fillh _Cons 2 3
pop_a 1
.d 1 0
rtn
case.2
repl_args 3 3
push_a 2
build _ 1 n10
push_a 2
build _ 1 e_StdString_ntoString;5
buildh _Cons 2
push_a 1
build _ 1 n10
build e_StdList_d++ 2 e_StdList_n++
buildAC "🌳"
buildh ARRAY 1
fillh _Cons 2 5
pop_a 3
.d 1 0
rtn
.n 2 _ ea9
.o 1 0
n9
push_node _cycle_in_spine 2
.o 3 0
ea9
jsr_eval 1
.o 3 0
s9
eq_desc d15 0 1
jmp_true case.3
jmp case.4
case.3
buildh d15 0
buildh d15 0
push_a 2
buildh e_StdInt_d<;17 0
buildI 33
push_a 1
update_a 1 2
update_a 0 1
pop_a 1
fillh d16 3 5
pop_a 2
.d 1 0
rtn
case.4
push_args 1 3 3
buildh _Nil 0
update_a 0 5
pop_a 1
push_a 3
jsr_eval 0
pushI_a 4
pop_a 1
push_a 1
jsr_eval 0
pushI_a 2
pop_a 1
ltI
jmp_false else.5
push_a 2
push_a 4
build _ 2 n9
.d 3 0
jmp s10
.o 3 0
s10
push_a 2
push_a 2
fillh d16 3 8
pop_a 5
.d 1 0
rtn
else.5
push_a 0
push_a 4
build _ 2 n9
push_a 3
push_a 3
push_a 2
update_a 2 3
update_a 1 2
update_a 0 1
pop_a 1
fillh d16 3 8
pop_a 5
.d 1 0
rtn
update_a 1 4
updatepop_a 0 3
.d 2 0
jmp e_StdList_sisMember;51
week04/Clean System Files/ex3.o
View file @
97aff46b
No preview for this file type
week04/ex1
View file @
97aff46b
No preview for this file type
week04/ex1.icl
View file @
97aff46b
...
...
@@ -22,8 +22,11 @@ instance serialize Int where
read
[
x
:
xs
]
=
Just
(
toInt
x
,
xs
)
read
_
=
Nothing
NilString
::=
"Nil"
instance
serialize
[
a
]
|
serialize
a
where
write
l
c
=
[
"["
]
++
flatMap
write
l
++
[
"]"
]
++
c
//write l c = ["["] ++ flatMap write l ++ ["]":c]
write
[]
c
=
[
NilString
:
c
]
read
[
"["
:
xs
]
=
readHelper
xs
[]
where
...
...
@@ -78,4 +81,6 @@ where
intLeaf
::
Bin
Int
intLeaf
=
Leaf
//t = [1,2,3]
//Start = [55,66:t]
Start
=
map
test
[[
1
,
2
],
[
5
,
6
]]
week04/ex3
View file @
97aff46b
No preview for this file type
week04/ex3.icl
View file @
97aff46b
...
...
@@ -12,7 +12,7 @@ class Container t where
instance
Container
[]
where
Cinsert
e
l
=
[
e
:
l
]
Ccontains
e
l
=
foldr
(||)
False
(
map
((==)
e
)
l
)
Ccontains
e
l
=
isMember
e
l
//
foldr (||) False (map ((==) e) l)
Cshow
l
=
map
toString
l
Cnew
=
[]
...
...
@@ -23,14 +23,15 @@ instance Container Bin where
|
otherwise
=
Bin
(
Cinsert
e
l
)
a
r
Ccontains
e
Leaf
=
False
Ccontains
e
(
Bin
l
a
r
)
=
e
==
a
||
Ccontains
e
l
||
Ccontains
e
r
Ccontains
e
(
Bin
l
a
r
)
|
e
==
a
=
True
|
e
>
a
=
Ccontains
e
r
|
otherwise
=
Ccontains
e
l
Cshow
Leaf
=
[
"🍁"
]
Cshow
(
Bin
l
e
r
)
=
[
"🌳"
:
Cshow
l
++
[
toString
e
:
Cshow
r
]]
Cnew
=
Leaf
//Start = Ccontains 3 [1,2,3]
Start
=
Cshow
(
Cinsert
5
(
Cinsert
3
(
Cinsert
1
(
Cinsert
2
(
Cinsert
4
Leaf
)))))
//Start = foldr (+) 0 [1,2,3]
\ No newline at end of file
Start
=
Ccontains
[
1
,
2
,
3
]
//Start = Cshow (Cinsert 5 (Cinsert 3 (Cinsert 1 (Cinsert 2 (Cinsert 4 Leaf)))))
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