Commit 95b83400 authored by Vincent Zweije's avatar Vincent Zweije
Browse files

First go at generating function definitions

parent 2c6cabd0
......@@ -3,16 +3,21 @@ definition module convert
// $Id$
from syntax import FunDef,FunType
from checksupport import DclModule
from rule import Rule
from coreclean import SuclTypeSymbol,SuclTypeVariable,SuclSymbol,SuclSymbolKind,SuclVariable
// Transitively required stuff
from syntax import Ident,Priority,FunctionBody,Optional,SymbolType,Position,DefOrImpFunKind,FunInfo,SymbolPtr,TypeVar,AType,AType,TypeContext,AttributeVar,AttrInequality,FunCall,Index,Level,FreeVar,FreeVar,ExprInfoPtr,BITVECT,Ptr,Specials,SymbolTableEntry,TypeVarInfoPtr,TypeAttribute,Annotation,Type,Context,Global,DefinedSymbol,Type,VarInfoPtr,AttrVarInfoPtr,Expression,VarInfoPtr,Ptr,ExprInfo,PtrN,HeapN,PtrN,STE_Kind,TypeVarInfo,VarInfo,AttrVarInfo
from syntax import Ident,Priority,FunctionBody,Optional,SymbolType,Position,DefOrImpFunKind,FunInfo,SymbolPtr,TypeVar,AType,AType,TypeContext,AttributeVar,AttrInequality,FunCall,Index,Level,FreeVar,FreeVar,ExprInfoPtr,BITVECT,Ptr,Specials,SymbolTableEntry,TypeVarInfoPtr,TypeAttribute,Annotation,Type,Context,Global,DefinedSymbol,Type,VarInfoPtr,AttrVarInfoPtr,Expression,VarInfoPtr,Ptr,ExprInfo,PtrN,HeapN,PtrN,STE_Kind,TypeVarInfo,VarInfo,AttrVarInfo,CheckedTypeDef,ClassDef,ClassInstance,ConsDef,Declaration,GenericDef,IndexRange,MemberDef,SelectorDef,ATypeVar,DeclarationRecord,GenericClassInfos,GenericType,InstanceType,TypeDef,TypeKind,TypeRhs,GenericClassInfo
from StdString import String
from checksupport import CommonDefs,ConversionTable,Declarations
from containers import NumberSet
// Cocl to Sucl for functions
cts_function
:: {#FunDef}
:: Int // Index of current module
{#FunDef} // Function definitions (from ICL)
-> ( [(SuclSymbol,Rule SuclTypeSymbol SuclTypeVariable)]//Type rule (derives arity)
, [(SuclSymbol,[Bool])] // Strict arguments (just main args for now)
, [(SuclSymbol,[Rule SuclSymbol SuclVariable])] // Rewrite rules
......@@ -20,6 +25,8 @@ cts_function
)
//Cocl to Sucl for exports (function decls from main dcl)
cts_exports
:: {#FunType} // Function type from dcl module
-> [SuclSymbol] // Function symbol for the declared function
cts_exports ::
{#FunDef} // List of function definitions (from ICL)
{#DclModule} // List of imported DCL modules
Int // Index of current module
-> [SuclSymbol]
This diff is collapsed.
......@@ -35,5 +35,7 @@ supercompile
supercompile common_defs array_instances dcl_mods main_dcl_module_n components fun_defs var_heap expression_heap imported_funs dcl_types used_conses_in_dynamics type_def_infos type_heaps
= (components,fun_defs,dcl_types,used_conses,var_heap,type_heaps,expression_heap)
where used_conses = abort "supercompile: not implemented"
// Determine defined functions
_ = cts_function fun_defs
_ = cts_exports dcl_mods[main_dcl_module_n].dcl_functions
// Determine exported functions
_ = cts_exports fun_defs dcl_mods main_dcl_module_n
Markdown is supported
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