diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2022-12-14 20:47:29 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2022-12-14 20:47:29 +0100 |
| commit | 71992db7d0e51f87934f7d9c0cf9ddbd3a8d0300 (patch) | |
| tree | d5ff9dbc6c74512def6a2329642790baef0bde4a /app/IR.hs | |
| parent | 60ff47250b5064c38b8f4889766696cb4a5683b0 (diff) | |
| download | prlg-71992db7d0e51f87934f7d9c0cf9ddbd3a8d0300.tar.gz prlg-71992db7d0e51f87934f7d9c0cf9ddbd3a8d0300.tar.bz2 | |
lists
Diffstat (limited to 'app/IR.hs')
| -rw-r--r-- | app/IR.hs | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 |
