Commit 100b1b2e authored by Ronny Wichers Schreur's avatar Ronny Wichers Schreur 🏘
Browse files

switch to 2.0 syntax, remove duplicated definitions from icl modules

parent 8e7ce204
......@@ -3,12 +3,7 @@
*/
definition module backendconvert
/*2.0
from backend import ::BackEnd
0.2*/
//1.3
from backend import BackEnd
//3.1
import frontend
backEndConvertModules :: PredefinedSymbols FrontEndSyntaxTree !Int *VarHeap *AttrVarHeap *BackEnd -> (!*VarHeap, *AttrVarHeap, !*BackEnd)
......@@ -654,14 +654,8 @@ class declare a :: ModuleIndex a -> BackEnder
class declareWithIndex a :: Index ModuleIndex a -> BackEnder
//1.3
instance declare {#a} | declareWithIndex a & ArrayElem a where
declare :: ModuleIndex {#a} -> BackEnder | declareWithIndex a & ArrayElem a
//3.1
/*2.0
instance declare {#a} | declareWithIndex a & Array {#} a where
declare :: ModuleIndex {#a} -> BackEnder | declareWithIndex a & Array {#} a
0.2*/
declare moduleIndex array
= foldStateWithIndexA (\i -> declareWithIndex i moduleIndex) array
......
......@@ -21,12 +21,7 @@ class preprocess a :: !Ident a -> Preprocessor
:: PreprocessState
:== VarHeap
//1.3
instance preprocess {#a} | preprocess a & ArrayElem a where
//3.1
/*2.0
instance preprocess {#a} | preprocess a & Array {#} a where
0.2*/
preprocess aliasDummyId array
= foldStateA (preprocess aliasDummyId) array
......
......@@ -3,14 +3,8 @@
*/
definition module backendsupport
/*2.0
from StdArray import class Array(size,usize)
from StdInt import class +,class ==
0.2*/
//1.3
from StdArray import size, size_u
from StdInt import +, ==
//3.1
from StdFunc import `bind`
import utilities
......
......@@ -2,73 +2,3 @@
module owner: Ronny Wichers Schreur
*/
implementation module backendsupport
import StdArray
/*2.0
from StdInt import class + (..),class == (..)
0.2*/
//1.3
from StdInt import +, ==
//3.1
from StdFunc import `bind`
identity
:== \x -> x
// binding sugar
(==>) infix
(==>) f g
:== f `bind` g
// o` :== flip o
(o`) infixr
(o`) f g
:== \x -> g (f x)
(:-) infixl
(:-) a f
:== f a
foldState function list
:== foldState list
where
foldState []
= identity
foldState [hd:tl]
= function hd
o` foldState tl
foldStateA function array
:== foldStateA 0
where
arraySize
= size array
foldStateA index
| index == arraySize
= identity
// otherwise
= function array.[index]
o` foldStateA (index+1)
foldStateWithIndexA function array
:== foldStateWithIndexA 0
where
arraySize
= size array
foldStateWithIndexA index
| index == arraySize
= identity
// otherwise
= function index array.[index]
o` foldStateWithIndexA (index+1)
foldrA function result array
:== foldrA 0
where
arraySize
= size array
foldrA index
| index == arraySize
= result
// otherwise
= function array.[index] (foldrA (index+1))
......@@ -150,13 +150,8 @@ convertDynamicPatternsIntoUnifyAppls global_type_instances common_defs main_dcl_
= case tcl_file of
No
-> (No,type_heaps,ci_predef_symb)
/*2.0
_
# tcl_file = f tcl_file;
0.2*/
//1.3
(Yes tcl_file)
//3.1
# (ok,tcl_file,type_heaps,ci_predef_symb)
= write_tcl_file main_dcl_module_n dcl_mods icl_mod.icl_common tcl_file directly_imported_dcl_modules global_type_instances ci_type_constructor_used_in_dynamic_patterns type_heaps ci_predef_symb
| not ok
......
......@@ -1729,11 +1729,6 @@ splitGuards (BasicPatterns basicType patterns)
splitGuards (OverloadedListPatterns type decons_expr patterns)
= [OverloadedListPatterns type decons_expr [pattern] \\ pattern <- patterns]
:: TypedVariable =
{ tv_free_var :: !FreeVar
, tv_type :: !AType
}
copyExpression :: ![TypedVariable] !Expression !*VarHeap -> (![Expression], ![TypedVariable], ![FreeVar], !Expression, !*VarHeap)
copyExpression bound_vars expr var_heap
# var_heap = foldSt (\{tv_free_var={fv_info_ptr},tv_type} -> writePtr fv_info_ptr (VI_BoundVar tv_type)) bound_vars var_heap
......
......@@ -3,14 +3,8 @@
*/
definition module frontend
/*2.0
from scanner import ::SearchPaths
from general import ::Optional, Yes, No
0.2*/
//1.3
from scanner import SearchPaths
from general import Optional, Yes, No
//3.1
from general import ::Optional (Yes, No)
import checksupport, transform, overloading
:: FrontEndOptions
......
......@@ -8,32 +8,11 @@ import scanner, parse, postparse, check, type, trans, convertcases, overloading,
//import print
:: FrontEndOptions
= { feo_up_to_phase :: !FrontEndPhase
, feo_generics :: !Bool
, feo_fusion :: !Bool
}
:: FrontEndSyntaxTree
= { fe_icl :: !IclModule
, fe_dcls :: !{#DclModule}
, fe_components :: !{!Group}
, fe_arrayInstances :: !ArrayAndListInstances
}
// trace macro
(-*->) infixl
(-*->) value trace
:== value // ---> trace
:: FrontEndPhase
= FrontEndPhaseCheck
| FrontEndPhaseTypeCheck
| FrontEndPhaseConvertDynamics
| FrontEndPhaseTransformGroups
| FrontEndPhaseConvertModules
| FrontEndPhaseAll
instance == FrontEndPhase where
(==) a b
= equal_constructor a b
......@@ -409,12 +388,6 @@ where
show_dcl_function {ft_symb, ft_type} file
= file <<< ft_symb <<< " :: " <<< ft_type <<< "\n"
:: ListTypesKind = ListTypesNone | ListTypesInferred | ListTypesStrictExports | ListTypesAll
:: ListTypesOption =
{ lto_showAttributes :: Bool
, lto_listTypesKind :: ListTypesKind
}
instance == ListTypesKind where
(==) ListTypesNone ListTypesNone
= True
......
......@@ -120,10 +120,10 @@ where
-> (Yes cees, var_heap, symbol_heap)
No
*/
-> (No, var_heap, symbol_heap)
_
-> (No, var_heap, symbol_heap)
*/ -> (No, var_heap, symbol_heap)
| otherwise
= (No, var_heap, symbol_heap)
split_case split_var_info_ptr (Let lad=:{let_expr,let_strict_binds,let_lazy_binds}) var_heap symbol_heap
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment