Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
ab18d547
Commit
ab18d547
authored
Jun 09, 2000
by
Martin Wierich
Browse files
Added preprocessor directives, so that one and the same source can be
compiled with Clean 1.3 and Clean 2.0
parent
3a4ab7e1
Changes
5
Hide whitespace changes
Inline
Side-by-side
frontend/_aconcat.dcl
View file @
ab18d547
...
@@ -7,8 +7,12 @@ arrayConcat a1 a2
...
@@ -7,8 +7,12 @@ arrayConcat a1 a2
where
where
r2
={
r1
&
[
i
+
s1
]=
a2
.[
i
]
\\
i
<-[
0
..
s2
-1
]}
r2
={
r1
&
[
i
+
s1
]=
a2
.[
i
]
\\
i
<-[
0
..
s2
-1
]}
r1
={
r0
&
[
i
]=
a1
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
r1
={
r0
&
[
i
]=
a1
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray (s1+s2) // 2.0
/*2.0
r0=_createArray (s1+s2)
0.2*/
//1.3
r0
=
_createArrayc
(
s1
+
s2
)
r0
=
_createArrayc
(
s1
+
s2
)
//3.1
s1
=
size
a1
s1
=
size
a1
s2
=
size
a2
s2
=
size
a2
...
@@ -17,20 +21,26 @@ arrayPlusList a l
...
@@ -17,20 +21,26 @@ arrayPlusList a l
where
where
r2
={
r1
&
[
i
+
s1
]=
e
\\
i
<-[
0
..
s2
-1
]
&
e
<-
l
}
r2
={
r1
&
[
i
+
s1
]=
e
\\
i
<-[
0
..
s2
-1
]
&
e
<-
l
}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray (s1+s2) // 2.0
/*2.0
r0=_createArray (s1+s2)
0.2*/
//1.3
r0
=
_createArrayc
(
s1
+
s2
)
r0
=
_createArrayc
(
s1
+
s2
)
//3.1
s1
=
size
a
s1
=
size
a
s2
=
length
l
s2
=
length
l
arrayPlusRevList
a
l
arrayPlusRevList
a
l
:==
r2
:==
r2
where
where
r2
={
r1
&
[
sr
-
i
]=
e
\\
i
<-[
1
..
s2
]
&
e
<-
l
}
r2
={
r1
&
[
sr
-
i
]=
e
\\
i
<-[
1
..
s2
]
&
e
<-
l
}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray sr // 2.0
/*2.0
r0=_createArray sr // 2.0
0.2*/
//1.3
r0
=
_createArrayc
sr
r0
=
_createArrayc
sr
//3.1
sr
=
s1
+
s2
sr
=
s1
+
s2
s1
=
size
a
s1
=
size
a
s2
=
length
l
s2
=
length
l
frontend/_aconcat.icl
View file @
ab18d547
...
@@ -7,18 +7,26 @@ arrayConcat a1 a2
...
@@ -7,18 +7,26 @@ arrayConcat a1 a2
where
where
r2
={
r1
&
[
i
+
s1
]=
a2
.[
i
]
\\
i
<-[
0
..
s2
-1
]}
r2
={
r1
&
[
i
+
s1
]=
a2
.[
i
]
\\
i
<-[
0
..
s2
-1
]}
r1
={
r0
&
[
i
]=
a1
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
r1
={
r0
&
[
i
]=
a1
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray (s1+s2) // 2.0
/*2.0
r0=_createArray (s1+s2)
0.2*/
//1.3
r0
=
_createArrayc
(
s1
+
s2
)
r0
=
_createArrayc
(
s1
+
s2
)
//3.1
s1
=
size
a1
s1
=
size
a1
s2
=
size
a2
s2
=
size
a2
arrayPlusList
a
l
arrayPlusList
a
l
:==
r2
:==
r2
where
where
r2
={
r1
&
[
i
+
s1
]=
e
\\
i
<-[
0
..
s2
-1
]
&
e
<-
l
}
r2
={
r1
&
[
i
+
s1
]=
e
\\
i
<-[
0
..
s2
-1
]
&
e
<-
l
}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray (s1+s2) // 2.0
/*2.0
r0=_createArray (s1+s2)
0.2*/
//1.3
r0
=
_createArrayc
(
s1
+
s2
)
r0
=
_createArrayc
(
s1
+
s2
)
//3.1
s1
=
size
a
s1
=
size
a
s2
=
length
l
s2
=
length
l
...
@@ -27,10 +35,12 @@ arrayPlusRevList a l
...
@@ -27,10 +35,12 @@ arrayPlusRevList a l
where
where
r2
={
r1
&
[
sr
-
i
]=
e
\\
i
<-[
1
..
s2
]
&
e
<-
l
}
r2
={
r1
&
[
sr
-
i
]=
e
\\
i
<-[
1
..
s2
]
&
e
<-
l
}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
r1
={
r0
&
[
i
]=
a
.[
i
]
\\
i
<-[
0
..
s1
-1
]}
// r0=_createArray sr // 2.0
/*2.0
r0=_createArray sr // 2.0
0.2*/
//1.3
r0
=
_createArrayc
sr
r0
=
_createArrayc
sr
//3.1
sr
=
s1
+
s2
sr
=
s1
+
s2
s1
=
size
a
s1
=
size
a
s2
=
length
l
s2
=
length
l
frontend/comparedefimp.icl
View file @
ab18d547
...
@@ -154,10 +154,14 @@ compareDefImp untransformed dcl_modules icl_module heaps error_admin
...
@@ -154,10 +154,14 @@ compareDefImp untransformed dcl_modules icl_module heaps error_admin
compareWithConversions
conversions
dclDefs
iclDefs
tc_state
error_admin
compareWithConversions
conversions
dclDefs
iclDefs
tc_state
error_admin
=
iFoldSt
(
compareWithConversion
conversions
dclDefs
)
0
(
size
conversions
)
(
iclDefs
,
tc_state
,
error_admin
)
=
iFoldSt
(
compareWithConversion
conversions
dclDefs
)
0
(
size
conversions
)
(
iclDefs
,
tc_state
,
error_admin
)
// type definition for 1.3 (should be added for 2.0)
compareWithConversion
::
!{#
Int
}
!(
b
c
)
!
Int
!(!
u
:(
b
c
),
!*
TypesCorrespondState
,
!*
ErrorAdmin
)
compareWithConversion
::
!
w
:(
a
x
:
Int
)
!.(
b
c
)
!
Int
!(!
u
:(
d
c
),
!*
TypesCorrespondState
,
!*
ErrorAdmin
)
->
(!
v
:(
b
c
),
!.
TypesCorrespondState
,
!.
ErrorAdmin
)
->
(!
v
:(
d
c
),
!.
TypesCorrespondState
,
!.
ErrorAdmin
)
//1.3
|
Array
.
b
&
getIdentPos
,
select_u
,
t_corresponds
,
uselect_u
c
&
Array
.
d
&
Array
.
a
,
[
u
<=
v
,
w
<=
x
];
|
Array
.
b
&
getIdentPos
,
select_u
,
t_corresponds
,
uselect_u
c
,
[
u
<=
v
]
//3.1
/*2.0
| Array b c & t_corresponds, getIdentPos c, [u <= v]
0.2*/
compareWithConversion
conversions
dclDefs
dclIndex
(
iclDefs
,
tc_state
,
error_admin
)
compareWithConversion
conversions
dclDefs
dclIndex
(
iclDefs
,
tc_state
,
error_admin
)
#
(
iclDef
,
iclDefs
)
=
iclDefs
![
conversions
.[
dclIndex
]]
#
(
iclDef
,
iclDefs
)
=
iclDefs
![
conversions
.[
dclIndex
]]
(
corresponds
,
tc_state
)
=
t_corresponds
dclDefs
.[
dclIndex
]
iclDef
tc_state
(
corresponds
,
tc_state
)
=
t_corresponds
dclDefs
.[
dclIndex
]
iclDef
tc_state
...
@@ -169,10 +173,8 @@ compareFunctionTypesWithConversions conversions dcl_fun_types icl_functions tc_s
...
@@ -169,10 +173,8 @@ compareFunctionTypesWithConversions conversions dcl_fun_types icl_functions tc_s
=
iFoldSt
(
compareTwoFunctionTypes
conversions
dcl_fun_types
)
0
(
size
conversions
)
=
iFoldSt
(
compareTwoFunctionTypes
conversions
dcl_fun_types
)
0
(
size
conversions
)
(
icl_functions
,
tc_state
,
error_admin
)
(
icl_functions
,
tc_state
,
error_admin
)
// type definition for 1.3 (should be added for 2.0)
compareTwoFunctionTypes
::
!{#
Int
}
!{#
FunType
}
!
Int
!*(!
u
:{#
FunDef
},!*
TypesCorrespondState
,!*
ErrorAdmin
)
compareTwoFunctionTypes
::
!
w
:(
a
x
:
Int
)
!.(
b
FunType
)
!.
Int
!(!
u
:(
c
FunDef
),!*
TypesCorrespondState
,!*
ErrorAdmin
)
->
(!
v
:{#
FunDef
},!.
TypesCorrespondState
,!.
ErrorAdmin
)
,
[
u
<=
v
]
->
(!
v
:(
c
FunDef
),!.
TypesCorrespondState
,!.
ErrorAdmin
)
|
Array
.
b
&
Array
.
c
&
Array
.
a
,
[
u
<=
v
,
w
<=
x
];
compareTwoFunctionTypes
conversions
dcl_fun_types
dclIndex
(
icl_functions
,
tc_state
,
error_admin
)
compareTwoFunctionTypes
conversions
dcl_fun_types
dclIndex
(
icl_functions
,
tc_state
,
error_admin
)
#
(
fun_def
=:{
fun_type
},
icl_functions
)
=
icl_functions
![
conversions
.[
dclIndex
]]
#
(
fun_def
=:{
fun_type
},
icl_functions
)
=
icl_functions
![
conversions
.[
dclIndex
]]
=
case
fun_type
of
=
case
fun_type
of
...
@@ -335,9 +337,12 @@ instance t_corresponds [a] | t_corresponds a where
...
@@ -335,9 +337,12 @@ instance t_corresponds [a] | t_corresponds a where
=
return
False
=
return
False
// instance t_corresponds {# a} | t_corresponds a & Array {#} a // 2.0
/*2.0
instance t_corresponds {# a} | t_corresponds a & Array {#} a
0.2*/
//1.3
instance
t_corresponds
{#
a
}
|
ArrayElem
,
t_corresponds
a
instance
t_corresponds
{#
a
}
|
ArrayElem
,
t_corresponds
a
//3.1
where
where
t_corresponds
dclArray
iclArray
t_corresponds
dclArray
iclArray
#
size_dclArray
=
size
dclArray
#
size_dclArray
=
size
dclArray
...
@@ -345,7 +350,12 @@ where
...
@@ -345,7 +350,12 @@ where
=
return
False
=
return
False
=
loop
(
size_dclArray
-1
)
dclArray
iclArray
=
loop
(
size_dclArray
-1
)
dclArray
iclArray
where
where
// loop :: !Int !{# a} !{# a} -> *TypesCorrespondMonad | t_corresponds a & Array {#} a // 2.0
/*2.0
loop :: !Int !{# a} !{# a} -> *TypesCorrespondMonad | t_corresponds a & Array {#} a // 2.0
0.2*/
//1.3
loop
::
!
Int
!{#
a
}
!{#
a
}
->
*
TypesCorrespondMonad
|
t_corresponds
,
select_u
a
//3.1
loop
i
dclArray
iclArray
loop
i
dclArray
iclArray
|
i
<
0
|
i
<
0
=
return
True
=
return
True
...
...
frontend/convertcases.icl
View file @
ab18d547
...
@@ -1417,7 +1417,7 @@ where
...
@@ -1417,7 +1417,7 @@ where
mark_local_let_var_of_pattern_expr
depth
{
cv_variable
,
cv_count
}
var_heap
mark_local_let_var_of_pattern_expr
depth
{
cv_variable
,
cv_count
}
var_heap
#
(
VI_LetExpression
lei
,
var_heap
)
=
readPtr
cv_variable
var_heap
#
(
VI_LetExpression
lei
,
var_heap
)
=
readPtr
cv_variable
var_heap
|
depth
==
lei
.
lei_depth
|
depth
==
lei
.
lei_depth
=
var_heap
<:=
(
cv_variable
,
VI_LetExpression
{
lei
&
lei_count
=
cv_count
,
lei_status
=
LES_Untouched
})
=
(
var_heap
<:=
(
cv_variable
,
VI_LetExpression
{
lei
&
lei_count
=
cv_count
,
lei_status
=
LES_Untouched
})
)
==>
(
"mark_local_let_var_of_pattern_expr "
,
lei
.
lei_var
.
fv_name
,
cv_variable
,
(
lei
.
lei_var
.
fv_info_ptr
,
cv_count
,
depth
))
==>
(
"mark_local_let_var_of_pattern_expr "
,
lei
.
lei_var
.
fv_name
,
cv_variable
,
(
lei
.
lei_var
.
fv_info_ptr
,
cv_count
,
depth
))
=
var_heap
=
var_heap
...
...
frontend/utilities.dcl
View file @
ab18d547
...
@@ -9,7 +9,9 @@ import _aconcat
...
@@ -9,7 +9,9 @@ import _aconcat
For Strings
For Strings
*/
*/
from
StdString
import
String
// 1.3
//1.3
from
StdString
import
String
//3.1
stringToCharList
::
!
String
->
[
Char
]
stringToCharList
::
!
String
->
[
Char
]
charListToString
::
![
Char
]
->
String
charListToString
::
![
Char
]
->
String
...
...
Write
Preview
Supports
Markdown
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