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
f20b3093
Commit
f20b3093
authored
Oct 24, 2012
by
John van Groningen
Browse files
in the generic representation use RECORD instead of OBJECT and CONS for records,
change GenericInfo
parent
36099dbf
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
frontend/checkgenerics.icl
View file @
f20b3093
...
...
@@ -44,7 +44,7 @@ where
#
initial_info
=
{
gen_classes
=
createArray
32
[]
,
gen_var_kinds
=
[]
,
gen_
OBJECT_CONS_FIELD_indic
es
=
createArray
3
{
o
cf_module
=
-1
,
o
cf_index
=
-1
,
o
cf_ident
={
id_name
=
""
,
id_info
=
nilPtr
}}
,
gen_
rep_cons
es
=
createArray
4
{
g
cf_module
=
-1
,
g
cf_index
=
-1
,
g
cf_ident
={
id_name
=
""
,
id_info
=
nilPtr
}}
}
#
(
gen_info_ptr
,
hp_generic_heap
)
=
newPtr
initial_info
hp_generic_heap
=
(
{
gen_def
&
gen_info_ptr
=
gen_info_ptr
},
...
...
frontend/generics1.icl
View file @
f20b3093
This diff is collapsed.
Click to expand it.
frontend/parse.icl
View file @
f20b3093
...
...
@@ -569,6 +569,7 @@ where
#
(
ok
,
{
at_type
=
type
},
pState
)
=
trySimpleType
TA_None
pState
#
(
ident
,
pState
)
=
stringToIdent
name
(
IC_GenericCase
type
)
pState
#
(
type_CONS_ident
,
pState
)
=
stringToIdent
"CONS"
IC_Type
pState
#
(
type_RECORD_ident
,
pState
)
=
stringToIdent
"RECORD"
IC_Type
pState
#
(
type_FIELD_ident
,
pState
)=
stringToIdent
"FIELD"
IC_Type
pState
#
(
type_OBJECT_ident
,
pState
)=
stringToIdent
"OBJECT"
IC_Type
pState
#
(
generic_ident
,
pState
)
=
stringToIdent
name
IC_Generic
pState
...
...
@@ -599,14 +600,13 @@ where
->
case
type_cons
of
(
TypeConsSymb
{
type_ident
})
|
type_ident
==
type_CONS_ident
#
(
cons_CONS_ident
,
pState
)
=
stringToIdent
"GenericConsInfo"
IC_Expression
pState
->
(
PE_List
[
PE_Ident
cons_CONS_ident
,
geninfo_arg
],
pState
)
->
(
geninfo_arg
,
pState
)
|
type_ident
==
type_RECORD_ident
->
(
geninfo_arg
,
pState
)
|
type_ident
==
type_FIELD_ident
#
(
cons_FIELD_ident
,
pState
)
=
stringToIdent
"GenericFieldInfo"
IC_Expression
pState
->
(
PE_List
[
PE_Ident
cons_FIELD_ident
,
geninfo_arg
],
pState
)
->
(
geninfo_arg
,
pState
)
|
type_ident
==
type_OBJECT_ident
#
(
cons_OBJECT_ident
,
pState
)
=
stringToIdent
"GenericTypeDefInfo"
IC_Expression
pState
->
(
PE_List
[
PE_Ident
cons_OBJECT_ident
,
geninfo_arg
],
pState
)
->
(
geninfo_arg
,
pState
)
_
|
otherwise
->
(
geninfo_arg
,
pState
)
...
...
frontend/predef.dcl
View file @
f20b3093
...
...
@@ -170,35 +170,34 @@ PD_TypeEITHER :== 179
PD_TypePAIR
:==
180
// for constructor info
PD_TypeCONS
:==
181
PD_TypeFIELD
:==
182
PD_TypeOBJECT
:==
183
PD_GenericInfo
:==
184
//PD_TGenericConsDescriptor :== 184
PD_TGenericFieldDescriptor
:==
185
PD_TGenericTypeDefDescriptor
:==
186
PD_TGenConsPrio
:==
187
PD_TGenConsAssoc
:==
188
PD_TGenType
:==
189
PD_TypeGenericDict
:==
190
PD_TypeRECORD
:==
182
PD_TypeFIELD
:==
183
PD_TypeOBJECT
:==
184
PD_TGenericConsDescriptor
:==
185
PD_TGenericRecordDescriptor
:==
186
PD_TGenericFieldDescriptor
:==
187
PD_TGenericTypeDefDescriptor
:==
188
PD_TGenConsPrio
:==
189
PD_TGenConsAssoc
:==
190
PD_TGenType
:==
191
PD_TypeGenericDict
:==
192
// Generics fields
PD_map_to
:==
19
1
PD_map_from
:==
19
2
PD_map_to
:==
19
3
PD_map_from
:==
19
4
// Generics expression
PD_ConsBimap
:==
19
3
PD_ConsUNIT
:==
19
4
PD_ConsLEFT
:==
19
5
PD_ConsRIGHT
:==
19
6
PD_ConsPAIR
:==
19
7
PD_ConsBimap
:==
19
5
PD_ConsUNIT
:==
19
6
PD_ConsLEFT
:==
19
7
PD_ConsRIGHT
:==
19
8
PD_ConsPAIR
:==
19
9
// for constructor info
PD_ConsCONS
:==
198
PD_ConsFIELD
:==
199
PD_ConsOBJECT
:==
200
PD_NoGenericInfo
:==
201
PD_GenericConsInfo
:==
202
PD_GenericFieldInfo
:==
203
PD_GenericTypeInfo
:==
204
PD_CGenericConsDescriptor
:==
205
PD_ConsCONS
:==
200
PD_ConsRECORD
:==
201
PD_ConsFIELD
:==
202
PD_ConsOBJECT
:==
203
PD_CGenericConsDescriptor
:==
204
PD_CGenericRecordDescriptor
:==
205
PD_CGenericFieldDescriptor
:==
206
PD_CGenericTypeDefDescriptor
:==
207
PD_CGenConsNoPrio
:==
208
...
...
frontend/predef.icl
View file @
f20b3093
...
...
@@ -182,17 +182,16 @@ predefined_idents
[
PD_ConsPAIR
]
=
i
"PAIR"
,
[
PD_TypeCONS
]
=
i
"CONS"
,
[
PD_ConsCONS
]
=
i
"CONS"
,
[
PD_TypeRECORD
]
=
i
"RECORD"
,
[
PD_ConsRECORD
]
=
i
"RECORD"
,
[
PD_TypeFIELD
]
=
i
"FIELD"
,
[
PD_ConsFIELD
]
=
i
"FIELD"
,
[
PD_TypeOBJECT
]
=
i
"OBJECT"
,
[
PD_ConsOBJECT
]
=
i
"OBJECT"
,
[
PD_GenericInfo
]
=
i
"GenericInfo"
,
[
PD_NoGenericInfo
]
=
i
"NoGenericInfo"
,
[
PD_GenericConsInfo
]
=
i
"GenericConsInfo"
,
[
PD_GenericFieldInfo
]
=
i
"GenericFieldInfo"
,
[
PD_GenericTypeInfo
]
=
i
"GenericTypeDefInfo"
,
// [PD_TGenericConsDescriptor] = i "GenericConsDescriptor",
[
PD_TGenericConsDescriptor
]
=
i
"GenericConsDescriptor"
,
[
PD_CGenericConsDescriptor
]
=
i
"_GenericConsDescriptor"
,
[
PD_TGenericRecordDescriptor
]
=
i
"GenericRecordDescriptor"
,
[
PD_CGenericRecordDescriptor
]
=
i
"_GenericRecordDescriptor"
,
[
PD_TGenericFieldDescriptor
]
=
i
"GenericFieldDescriptor"
,
[
PD_CGenericFieldDescriptor
]
=
i
"_GenericFieldDescriptor"
,
[
PD_TGenericTypeDefDescriptor
]
=
i
"GenericTypeDefDescriptor"
,
...
...
@@ -248,7 +247,6 @@ predefined_idents
[
PD_FromThenToU
]=
i
"_from_then_to_u"
,
[
PD_FromThenToUTS
]=
i
"_from_then_to_uts"
,
[
PD_FromThenToO
]=
i
"_from_then_to_o"
}
=:
idents
where
...
...
frontend/syntax.dcl
View file @
f20b3093
...
...
@@ -412,13 +412,14 @@ cNameLocationDependent :== True
::
GenericInfo
=
{
gen_classes
::
!
GenericClassInfos
,
gen_var_kinds
::
![
TypeKind
]
// kinds of all st_vars of the gen_type
,
gen_OBJECT_CONS_FIELD_indices
::
!{#
OBJECT_CONS_FIELD_index
}
,
gen_rep_conses
::
!{#
GenericRepresentationConstructor
}
// OBJECT, CONS, RECORD, FIELD
}
::
OBJECT_CONS_FIELD_index
=
{
o
cf_module
::
!
Int
,
o
cf_index
::
!
Int
,
o
cf_ident
::
!
Ident
::
GenericRepresentationConstructor
=
{
g
cf_module
::
!
Int
,
g
cf_index
::
!
Int
,
g
cf_ident
::
!
Ident
}
::
GenericInfoPtr
:==
Ptr
GenericInfo
...
...
@@ -576,6 +577,7 @@ NoGlobalIndex :== {gi_module=NoIndex,gi_index=NoIndex}
|
GTSAppVar
TypeVar
[
GenTypeStruct
]
|
GTSVar
TypeVar
|
GTSCons
DefinedSymbol
GenTypeStruct
|
GTSRecord
DefinedSymbol
GenTypeStruct
|
GTSField
DefinedSymbol
GenTypeStruct
|
GTSObject
DefinedSymbol
GenTypeStruct
|
GTSPair
!
GenTypeStruct
!
GenTypeStruct
// for optimizing bimaps
...
...
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