aboutsummaryrefslogtreecommitdiff
path: root/snug-clean/src/Snug/Compile.dcl
blob: 9ad66ffaa90497bc2c81d53b54e2e9a95600a0dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
definition module Snug.Compile

from Data.Error import :: MaybeError
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] -> MaybeError String [Line]