summaryrefslogtreecommitdiff
path: root/app/IR.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/IR.hs')
-rw-r--r--app/IR.hs6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/IR.hs b/app/IR.hs
index 631cd16..f17547d 100644
--- a/app/IR.hs
+++ b/app/IR.hs
@@ -6,6 +6,7 @@ import qualified Data.Map as M
data PrlgStr
= CallS String [PrlgStr]
| LiteralS String
+ | ListS [PrlgStr] (Maybe PrlgStr)
deriving (Show)
data Id =
@@ -18,6 +19,7 @@ data Id =
data PrlgInt
= CallI Id [PrlgInt] --TODO this should be Int
| LiteralI Int
+ | ListI [PrlgInt] (Maybe PrlgInt) -- only exists before desugaring
| VarI Int Int -- VarI localIndex strTableString
| VoidI
deriving (Show)
@@ -40,3 +42,7 @@ internPrlg = go
go t (CallS str ps) =
let (t', i) = strtablize t str
in CallI (Id i $ length ps) <$> mapAccumL go t' ps
+ go t (ListS elems Nothing) = flip ListI Nothing <$> mapAccumL go t elems
+ go t (ListS elems (Just tail)) =
+ let (t', tail') = go t tail
+ in flip ListI (Just tail') <$> mapAccumL go t' elems