From bda2ff9eea470e7eb6dc573849dfc6abe8365069 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Fri, 27 Jan 2023 21:14:39 +0100 Subject: Add compilation of constructors and basic values --- snug-clean/src/Snug/Compile.dcl | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 snug-clean/src/Snug/Compile.dcl (limited to 'snug-clean/src/Snug/Compile.dcl') diff --git a/snug-clean/src/Snug/Compile.dcl b/snug-clean/src/Snug/Compile.dcl new file mode 100644 index 0000000..d329156 --- /dev/null +++ b/snug-clean/src/Snug/Compile.dcl @@ -0,0 +1,28 @@ +definition module Snug.Compile + +from Data.Map import :: Map + +from MIPS.MIPS32 import :: Line +from Snug.Syntax import :: ConstructorDef, :: ConstructorIdent, :: Definition, + :: SymbolIdent, :: Type + +:: Namespace :== String + +:: Namespaced id = + { ns :: !Namespace + , id :: !id + } + +:: Globals = + { constructors :: !Map (Namespaced ConstructorIdent) ConstructorDef + , functions :: !Map (Namespaced SymbolIdent) FunctionInfo + } + +:: FunctionInfo = + { arity :: !Int + , type :: !Type + } + +compile :: !Namespace ![Definition] -> [Line] + +compileDefinition :: !Namespace !Globals !Definition -> [Line] -- cgit v1.2.3