diff options
author | johnvg | 2012-08-14 10:03:06 +0000 |
---|---|---|
committer | johnvg | 2012-08-14 10:03:06 +0000 |
commit | 8f235418ef16fc1341fef9698688c3fdee20b79f (patch) | |
tree | 74da14decf5a0709f3254af5780a740f823a7c32 /frontend/syntax.dcl | |
parent | remove VI_Expression pointer values after copying a case alternative in the f... (diff) |
add extendable algebraic data types (merged from iTask branch)
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@2149 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'frontend/syntax.dcl')
-rw-r--r-- | frontend/syntax.dcl | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/frontend/syntax.dcl b/frontend/syntax.dcl index 37d020a..ab17380 100644 --- a/frontend/syntax.dcl +++ b/frontend/syntax.dcl @@ -74,6 +74,7 @@ instance == FunctionOrMacroIndex | STE_UsedQualifiedType !ModuleN !Index !STE_Kind | STE_BelongingSymbolExported | STE_BelongingSymbolForExportedSymbol + | STE_TypeExtension :: ModuleN:==Int; @@ -185,6 +186,8 @@ instance == FunctionOrMacroIndex | NewTypeCons !ParsedConstructor | EmptyRhs !BITVECT | AbstractTypeSpec !BITVECT !AType + | ExtendableConses ![ParsedConstructor] + | MoreConses !Ident ![ParsedConstructor] :: CollectedDefinitions instance_kind = { def_types :: ![TypeDef TypeRhs] @@ -523,6 +526,9 @@ cIsImportedObject :== False | NewType !DefinedSymbol | AbstractType !BITVECT | AbstractSynType !BITVECT !AType + | ExtendableAlgType ![DefinedSymbol] + | AlgConses ![DefinedSymbol] !GlobalIndex + | UncheckedAlgConses !Ident ![DefinedSymbol] | UnknownType :: ParsedTypeDef :== TypeDef RhsDefsOfType @@ -578,7 +584,7 @@ NoGlobalIndex :== {gi_module=NoIndex,gi_index=NoIndex} | GTSE | GTSAppConsBimapKindConst // for optimizing bimaps | GTSAppBimap TypeKind [GenTypeStruct] // for optimizing bimaps - | GTSAppConsSimpleType !(Global Index) !TypeKind ![GenTypeStruct] // for optimizing bimaps + | GTSAppConsSimpleType !GlobalIndex !TypeKind ![GenTypeStruct] // for optimizing bimaps :: GenericTypeRep = { gtr_type :: GenTypeStruct // generic structure type @@ -699,7 +705,7 @@ pIsSafe :== True :: OptionalVariable :== Optional (Bind Ident VarInfoPtr) :: AuxiliaryPattern - = AP_Algebraic !(Global DefinedSymbol) !Index [AuxiliaryPattern] OptionalVariable + = AP_Algebraic !(Global DefinedSymbol) !GlobalIndex ![AuxiliaryPattern] !OptionalVariable | AP_Variable !Ident !VarInfoPtr OptionalVariable | AP_Basic !BasicValue OptionalVariable | AP_NewType !(Global DefinedSymbol) !Index AuxiliaryPattern OptionalVariable @@ -708,7 +714,7 @@ pIsSafe :== True | AP_WildCard !OptionalVariable | AP_Empty -:: AP_Kind = APK_Constructor !Index | APK_NewTypeConstructor !Index | APK_Macro !Bool // is_dcl_macro +:: AP_Kind = APK_Constructor !GlobalIndex | APK_NewTypeConstructor !Index | APK_Macro !Bool // is_dcl_macro :: VI_TypeInfo = VITI_Empty | VITI_Coercion CoercionPosition @@ -930,7 +936,7 @@ cNotVarNumber :== -1 { cons_ident :: !Ident , cons_type :: !SymbolType , cons_priority :: !Priority - , cons_number :: !Index // -2 for newtype constructor + , cons_number :: !Index // -2 for newtype constructor, -3 for added constructor , cons_type_index :: !Index , cons_exi_vars :: ![ATypeVar] , cons_type_ptr :: !VarInfoPtr @@ -1362,16 +1368,16 @@ cIsNotStrict :== False , dyn_type_code :: !TypeCodeExpression /* filled after type checking */ } -:: CasePatterns= AlgebraicPatterns !(Global Index) ![AlgebraicPattern] +:: CasePatterns= AlgebraicPatterns !GlobalIndex ![AlgebraicPattern] | BasicPatterns !BasicType [BasicPattern] - | NewTypePatterns !(Global Index) ![AlgebraicPattern] + | NewTypePatterns !GlobalIndex ![AlgebraicPattern] | DynamicPatterns [DynamicPattern] /* auxiliary */ | OverloadedListPatterns !OverloadedListType !Expression ![AlgebraicPattern] | NoPattern /* auxiliary */ -:: OverloadedListType = UnboxedList !(Global Index) !Index !Index !Index // list_type_symbol StdStrictLists module index, decons_u index, nil_u index - | UnboxedTailStrictList !(Global Index) !Index !Index !Index // list_type_symbol StdStrictLists module index, decons_uts index, nil_uts index - | OverloadedList !(Global Index) !Index !Index !Index // list_type_symbol StdStrictLists module index, decons index, nil index +:: OverloadedListType = UnboxedList !GlobalIndex !Index !Index !Index // list_type_symbol StdStrictLists module index, decons_u index, nil_u index + | UnboxedTailStrictList !GlobalIndex !Index !Index !Index // list_type_symbol StdStrictLists module index, decons_uts index, nil_uts index + | OverloadedList !GlobalIndex !Index !Index !Index // list_type_symbol StdStrictLists module index, decons index, nil index instance == OverloadedListType |