From 5a3007ea91a3ee57a4fc3e34c0edd59a90b525c3 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 27 Nov 2023 19:00:20 +0100 Subject: WIP on code generation for case expressions --- snug-clean/src/Snug/Compile.dcl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'snug-clean/src/Snug/Compile.dcl') diff --git a/snug-clean/src/Snug/Compile.dcl b/snug-clean/src/Snug/Compile.dcl index 9ad66ff..ef223b8 100644 --- a/snug-clean/src/Snug/Compile.dcl +++ b/snug-clean/src/Snug/Compile.dcl @@ -1,5 +1,6 @@ definition module Snug.Compile +from Control.Monad.State import :: StateT from Data.Error import :: MaybeError from Data.Map import :: Map @@ -24,4 +25,17 @@ from Snug.Syntax import :: ConstructorDef, :: ConstructorIdent, :: Definition, , type :: !Type } +:: CompileM a :== StateT CompileState (MaybeError String) a + +:: CompileState + +:: Locals :== Map SymbolIdent LocalLocation + +:: Local = + { location :: !LocalLocation + , type :: !Type + } + +:: LocalLocation + compile :: !Namespace ![Definition] -> MaybeError String [Line] -- cgit v1.2.3