summaryrefslogtreecommitdiff
path: root/app/Compiler.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Compiler.hs')
-rw-r--r--app/Compiler.hs18
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)