Skip to content
GitLab
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
09c8eb4b
Commit
09c8eb4b
authored
May 03, 2001
by
Artem Alimarine
Browse files
added preliminary support for cons info by type
parent
73859fd1
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
frontend/check.icl
View file @
09c8eb4b
...
...
@@ -34,6 +34,7 @@ checkGenerics
,
KindArrow
[
KindConst
,
KindConst
]
]
#
(
kinds_ptr
,
th_vars
)
=
newPtr
(
TVI_Kinds
kinds
)
th_vars
#
(
cons_ptr
,
th_vars
)
=
newPtr
(
TVI_Empty
)
th_vars
#
cs
=
{
cs
&
cs_error
=
cs_error
,
cs_symbol_table
=
cs_symbol_table
}
#
type_heaps
=
{
type_heaps
&
th_vars
=
th_vars
}
...
...
@@ -50,6 +51,7 @@ checkGenerics
{
generic_def
&
gen_type
=
{
gen_type
&
gt_vars
=
gt_vars
,
gt_type
=
gt_type
}
,
gen_kinds_ptr
=
kinds_ptr
,
gen_cons_ptr
=
cons_ptr
}
#
generic_defs
=
{
generic_defs
&
[
gen_index
]
=
generic_def
}
...
...
frontend/generics.icl
View file @
09c8eb4b
This diff is collapsed.
Click to expand it.
frontend/parse.icl
View file @
09c8eb4b
...
...
@@ -1231,6 +1231,7 @@ wantGenericDefinition context pos pState
,
gen_kinds_ptr
=
nilPtr
,
gen_classes
=
[]
,
gen_isomap
=
MakeDefinedSymbol
{
id_name
=
""
,
id_info
=
nilPtr
}
NoIndex
0
,
gen_cons_ptr
=
nilPtr
}
=
(
PD_Generic
gen_def
,
pState
)
where
...
...
frontend/syntax.dcl
View file @
09c8eb4b
...
...
@@ -270,6 +270,7 @@ cNameLocationDependent :== True
,
gen_type
::
!
GenericType
,
gen_pos
::
!
Position
,
gen_kinds_ptr
::
!
TypeVarInfoPtr
// hack: contains all used kinds
,
gen_cons_ptr
::
!
TypeVarInfoPtr
// hack: cons instance function
,
gen_classes
::
!
GenericClassInfos
// generated classes
,
gen_isomap
::
!
DefinedSymbol
// isomap function
}
...
...
@@ -307,6 +308,7 @@ addGenericKind :: !GenericDef !TypeKind -> !GenericDef
,
ins_pos
::
!
Position
,
ins_is_generic
::
!
Bool
//AA
,
ins_generate
::
!
Bool
//AA
,
ins_partial
::
!
Bool
//AA
,
ins_generic
::
!
Global
Index
//AA
}
...
...
@@ -867,6 +869,7 @@ cNonRecursiveAppl :== False
|
TVI_TypeCode
!
TypeCodeExpression
|
TVI_CPSLocalTypeVar
!
Int
/* MdM - the index of the variable as generated by the theorem prover */
|
TVI_Kinds
![
TypeKind
]
// AA: used to collect kinds during checking
|
TVI_ConsInstance
!
DefinedSymbol
//AA: generic cons instance function
|
TVI_Normalized
!
Int
/* MV - position of type variable in its definition */
::
TypeVarInfoPtr
:==
Ptr
TypeVarInfo
...
...
@@ -1309,7 +1312,8 @@ ParsedInstanceToClassInstance pi members :==
it_context
=
pi
.
pi_context
},
ins_members
=
members
,
ins_specials
=
pi
.
pi_specials
,
ins_pos
=
pi
.
pi_pos
,
/*AA*/
ins_is_generic
=
False
,
ins_generate
=
pi
.
pi_generate
,
ins_generate
=
pi
.
pi_generate
,
ins_partial
=
False
,
ins_generic
=
{
glob_module
=
NoIndex
,
glob_object
=
NoIndex
}}
MakeTypeDef
name
lhs
rhs
attr
contexts
pos
:==
...
...
frontend/syntax.icl
View file @
09c8eb4b
...
...
@@ -260,6 +260,7 @@ cNameLocationDependent :== True
,
gen_type
::
!
GenericType
,
gen_pos
::
!
Position
,
gen_kinds_ptr
::
!
TypeVarInfoPtr
// hack: contains all used kinds
,
gen_cons_ptr
::
!
TypeVarInfoPtr
// hack: cons instance function
,
gen_classes
::
!
GenericClassInfos
// generated classes
,
gen_isomap
::
!
DefinedSymbol
// isomap function
}
...
...
@@ -315,6 +316,7 @@ addGenericKind generic_def=:{gen_name, gen_classes} kind
,
ins_pos
::
!
Position
,
ins_is_generic
::
!
Bool
//AA
,
ins_generate
::
!
Bool
//AA
,
ins_partial
::
!
Bool
//AA
,
ins_generic
::
!
Global
Index
//AA
}
...
...
@@ -837,6 +839,7 @@ cNotVarNumber :== -1
|
TVI_TypeCode
!
TypeCodeExpression
|
TVI_CPSLocalTypeVar
!
Int
/* MdM - the index of the variable as generated by the theorem prover */
|
TVI_Kinds
![
TypeKind
]
// AA: used to collect kinds during checking
|
TVI_ConsInstance
!
DefinedSymbol
//AA: generic cons instance function
|
TVI_Normalized
!
Int
/* MV - position of type variable in its definition */
::
TypeVarInfoPtr
:==
Ptr
TypeVarInfo
...
...
@@ -2093,7 +2096,8 @@ ParsedInstanceToClassInstance pi members :==
it_context
=
pi
.
pi_context
},
ins_members
=
members
,
ins_specials
=
pi
.
pi_specials
,
ins_pos
=
pi
.
pi_pos
,
/*AA*/
ins_is_generic
=
False
,
ins_generate
=
pi
.
pi_generate
,
ins_generate
=
pi
.
pi_generate
,
ins_partial
=
False
,
ins_generic
=
{
glob_module
=
NoIndex
,
glob_object
=
NoIndex
}}
MakeTypeDef
name
lhs
rhs
attr
contexts
pos
:==
...
...
frontend/transform.dcl
View file @
09c8eb4b
...
...
@@ -14,6 +14,19 @@ partitionateMacros :: !IndexRange !Index !PredefinedSymbol !*{# FunDef} !*{# Dcl
::
CopiedLocalFunctions
// AA..
::
CollectState
=
{
cos_var_heap
::
!.
VarHeap
,
cos_symbol_heap
::
!.
ExpressionHeap
,
cos_error
::
!.
ErrorAdmin
,
cos_alias_dummy
::
!
PredefinedSymbol
}
determineVariablesAndRefCounts
::
![
FreeVar
]
!
Expression
!*
CollectState
->
(!
Expression
,
![
FreeVar
],
![
FreeVar
],
!*
CollectState
)
// ..AA
::
UnfoldState
=
{
us_var_heap
::
!.
VarHeap
,
us_symbol_heap
::
!.
ExpressionHeap
...
...
@@ -31,5 +44,4 @@ partitionateMacros :: !IndexRange !Index !PredefinedSymbol !*{# FunDef} !*{# Dcl
::
AciFreeVarHandleMode
=
LeaveThem
|
RemoveThem
|
SubstituteThem
class
unfold
a
::
!
a
!
UnfoldInfo
!*
UnfoldState
->
(!
a
,
!*
UnfoldState
)
instance
unfold
Expression
,
CasePatterns
frontend/transform.icl
View file @
09c8eb4b
...
...
@@ -331,7 +331,6 @@ where
unfold
fv
=:{
fv_info_ptr
,
fv_name
}
ui
us
=:{
us_var_heap
}
#
(
new_info_ptr
,
us_var_heap
)
=
newPtr
VI_Empty
us_var_heap
=
({
fv
&
fv_info_ptr
=
new_info_ptr
},
{
us
&
us_var_heap
=
writePtr
fv_info_ptr
(
VI_Variable
fv_name
new_info_ptr
)
us_var_heap
})
instance
unfold
App
where
unfold
app
=:{
app_symb
={
symb_kind
},
app_args
,
app_info_ptr
}
ui
=:{
ui_convert_module_n
,
ui_conversion_table
}
us
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment