diff options
author | Camil Staps | 2023-01-27 21:14:39 +0100 |
---|---|---|
committer | Camil Staps | 2023-01-27 21:15:57 +0100 |
commit | bda2ff9eea470e7eb6dc573849dfc6abe8365069 (patch) | |
tree | 1fa299d5be537c6dc33a4d9289d9358723cd5490 /snug-clean/src/Snug/Compile.dcl | |
parent | Add Clean parser for snug (diff) |
Add compilation of constructors and basic values
Diffstat (limited to 'snug-clean/src/Snug/Compile.dcl')
-rw-r--r-- | snug-clean/src/Snug/Compile.dcl | 28 |
1 files changed, 28 insertions, 0 deletions
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] |