diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2022-11-12 17:47:51 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2022-11-12 17:47:51 +0100 |
| commit | b9633a33182f5b381e912366273709e59f469bb9 (patch) | |
| tree | 0b7eb7f1e67792253cfaf9caee3a92570ab60407 /app/Compiler.hs | |
| parent | fe6666d204c0728b4556574ddc184bc46013b193 (diff) | |
| download | prlg-b9633a33182f5b381e912366273709e59f469bb9.tar.gz prlg-b9633a33182f5b381e912366273709e59f469bb9.tar.bz2 | |
reorg.
Diffstat (limited to 'app/Compiler.hs')
| -rw-r--r-- | app/Compiler.hs | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/app/Compiler.hs b/app/Compiler.hs index 4f94637..b3294a1 100644 --- a/app/Compiler.hs +++ b/app/Compiler.hs @@ -3,19 +3,9 @@ module Compiler where import Data.Char (isUpper) import Data.Containers.ListUtils (nubOrd) import Data.List -import Interpreter (Code, Datum(..), Id(..), Instr(..), StrTable, strtablize) -data PrlgStr - = CallS String [PrlgStr] - | LiteralS String - deriving (Show) - -data PrlgInt - = CallI Id [PrlgInt] - | LiteralI Int - | VarI Int Int - | VoidI - deriving (Show) +import Code (Code, Datum(..), Instr(..)) +import IR (Id(..), PrlgInt(..), PrlgStr(..), StrTable, strtablize) varname :: String -> Bool varname ('_':_) = True @@ -28,8 +18,8 @@ varnames (LiteralS x) | varname x = [x] | otherwise = [] -strtablizePrlg :: [String] -> StrTable -> PrlgStr -> (StrTable, PrlgInt) -strtablizePrlg stab = go +internPrlg :: [String] -> StrTable -> PrlgStr -> (StrTable, PrlgInt) +internPrlg stab = go where go t (LiteralS str) | str == "_" = (t, VoidI) |
