aboutsummaryrefslogtreecommitdiff
path: root/snug-clean/src/Snug/Compile
diff options
context:
space:
mode:
Diffstat (limited to 'snug-clean/src/Snug/Compile')
-rw-r--r--snug-clean/src/Snug/Compile/Simulate.icl2
-rw-r--r--snug-clean/src/Snug/Compile/Typing.dcl13
-rw-r--r--snug-clean/src/Snug/Compile/Typing.icl14
3 files changed, 28 insertions, 1 deletions
diff --git a/snug-clean/src/Snug/Compile/Simulate.icl b/snug-clean/src/Snug/Compile/Simulate.icl
index b443913..57f249c 100644
--- a/snug-clean/src/Snug/Compile/Simulate.icl
+++ b/snug-clean/src/Snug/Compile/Simulate.icl
@@ -147,4 +147,4 @@ indirectAndEval =
, AddImmediate Signed HeapPtr HeapPtr (Immediate hp_offset)
]
_ ->
- fail "unexpected top of stack in indirect\n"
+ fail "unexpected top of stack in indirectAndEval\n"
diff --git a/snug-clean/src/Snug/Compile/Typing.dcl b/snug-clean/src/Snug/Compile/Typing.dcl
new file mode 100644
index 0000000..b395587
--- /dev/null
+++ b/snug-clean/src/Snug/Compile/Typing.dcl
@@ -0,0 +1,13 @@
+definition module Snug.Compile.Typing
+
+from Control.Monad.State import :: StateT
+from Data.Error import :: MaybeError
+from Data.Map import :: Map
+
+from Snug.Compile import :: CompileM, :: CompileState, :: LocalLocation,
+ :: Locals
+from Snug.Syntax import :: Expression, :: SymbolIdent, :: Type
+
+class type a :: !Locals !a -> CompileM Type
+
+instance type Expression
diff --git a/snug-clean/src/Snug/Compile/Typing.icl b/snug-clean/src/Snug/Compile/Typing.icl
new file mode 100644
index 0000000..5587da7
--- /dev/null
+++ b/snug-clean/src/Snug/Compile/Typing.icl
@@ -0,0 +1,14 @@
+implementation module Snug.Compile.Typing
+
+import Data.Error
+
+import Snug.Syntax
+
+instance type Expression
+where
+ type locals e = case e of
+ BasicValue bv -> type locals bv
+ Symbol sym -> // TODO
+ Constructor cons -> // TODO
+ Case _ alts -> checkSameTypes "case alternatives" [type locals e \\ CaseAlternative _ e <- alts]
+ ExpApp e1 e2 -> // TODO