Commit c577545d authored by Vincent Zweije's avatar Vincent Zweije
Browse files

Convert FunType (func decls from dcl) yielding exported function symbols

parent 6b47840f
......@@ -2,12 +2,12 @@ definition module convert
// $Id$
from syntax import FunDef
from syntax import FunDef,FunType
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,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
from StdString import String
// Cocl to Sucl for functions
......@@ -18,3 +18,8 @@ cts_function
, [(SuclSymbol,[Rule SuclSymbol SuclVariable])] // Rewrite rules
, [(SuclSymbol,SuclSymbolKind)] // Kind of symbol
)
//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
......@@ -304,3 +304,13 @@ convert_kind (FK_ImpFunction b) = SuclFunction // Function from a (the) impleme
convert_kind FK_DefMacro = SuclFunction // Macro from a definition module
convert_kind FK_ImpMacro = SuclFunction // Macro from an implementation module
convert_kind _ = abort "convert: convert_kind: unhandled DefOrImpFunKind constructor"
/****************************************************************
** Conversion of exported function symbols from cocl to sucl **
****************************************************************/
cts_exports :: {#FunType} -> [SuclSymbol]
cts_exports funtypes = [convert_funtype funtype\\funtype<-:funtypes]
convert_funtype :: FunType -> SuclSymbol
convert_funtype funtype = SuclUser funtype.ft_symb.id_info
......@@ -36,3 +36,4 @@ supercompile common_defs array_instances dcl_mods main_dcl_module_n components f
= (components,fun_defs,dcl_types,used_conses,var_heap,type_heaps,expression_heap)
where used_conses = abort "supercompile: not implemented"
_ = cts_function fun_defs
_ = cts_exports dcl_mods[main_dcl_module_n].dcl_functions
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