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/Compiler.hs | |
| parent | 60ff47250b5064c38b8f4889766696cb4a5683b0 (diff) | |
| download | prlg-71992db7d0e51f87934f7d9c0cf9ddbd3a8d0300.tar.gz prlg-71992db7d0e51f87934f7d9c0cf9ddbd3a8d0300.tar.bz2 | |
lists
Diffstat (limited to 'app/Compiler.hs')
| -rw-r--r-- | app/Compiler.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/app/Compiler.hs b/app/Compiler.hs index 67ca20f..84a63a4 100644 --- a/app/Compiler.hs +++ b/app/Compiler.hs @@ -6,6 +6,16 @@ import qualified Data.Map as M import Code (Code, Datum(..), Heap, Instr(..), heapStruct) import IR (Id(..), PrlgInt(..), StrTable(..)) +desugarPrlg :: Int -> PrlgInt -> PrlgInt +desugarPrlg list = go + where + go (CallI id ps) = CallI id $ map go ps + go (ListI (x:xs) t) = + CallI Id {str = list, arity = 2} [go x, go (ListI xs t)] + go (ListI [] Nothing) = LiteralI list + go (ListI [] (Just x)) = go x + go x = x + varname :: String -> Bool varname ('_':_) = True varname (c:_) = isUpper c |
