definition module Snug.Compile from Control.Monad.State import :: StateT 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 } :: CompileM a :== StateT CompileState (MaybeError String) a :: CompileState :: Locals :== Map SymbolIdent Symbol :: Symbol = LocalSymbol !LocalLocation | FunctionSymbol !FunctionInfo | ConstructorSymbol !ConstructorDef :: LocalLocation compile :: !Namespace ![Definition] -> MaybeError String [Line] lookupConstructorM :: !ConstructorIdent -> CompileM ConstructorDef