summaryrefslogtreecommitdiff
path: root/app/Load.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-03-05 21:34:20 +0100
committerMirek Kratochvil <exa.exa@gmail.com>2023-03-05 21:34:20 +0100
commit98c40f4bf8849f5cdd3d3c49123bc911b8fa42e1 (patch)
treee41a1cd05d17765f9e27b0844580655b2dc1ae95 /app/Load.hs
parent45c3f81891837820aea7c3dbd45e3bae25fc4c22 (diff)
downloadprlg-98c40f4bf8849f5cdd3d3c49123bc911b8fa42e1.tar.gz
prlg-98c40f4bf8849f5cdd3d3c49123bc911b8fa42e1.tar.bz2
strings and a few other small nice changes
Diffstat (limited to 'app/Load.hs')
-rw-r--r--app/Load.hs13
1 files changed, 5 insertions, 8 deletions
diff --git a/app/Load.hs b/app/Load.hs
index 9fb4c94..5a482fd 100644
--- a/app/Load.hs
+++ b/app/Load.hs
@@ -1,6 +1,6 @@
module Load where
-import Code (Code, PrlgEnv)
+import Code (Code, Id(..), PrlgEnv)
import CodeLens
import qualified Compiler as C
import Control.Monad.Trans.Class (lift)
@@ -21,20 +21,19 @@ tokenize fn = left MP.errorBundlePretty . MP.parse P.lexPrlg fn
parse :: String -> [P.Lexeme] -> Either String [P.PAST]
parse fn = left MP.errorBundlePretty . MP.parse P.parsePrlg fn
-shunt :: P.PAST -> ExceptT String PrlgEnv IR.PrlgStr
+shunt :: P.PAST -> ExceptT String PrlgEnv P.PrlgStr
shunt past = do
ops <- lift $ use ops
except . left (\err -> "operator resolution: " ++ err ++ "\n") $
P.shuntPrlg ops past
-intern :: IR.PrlgStr -> PrlgEnv IR.PrlgInt
+intern :: P.PrlgStr -> PrlgEnv IR.PrlgInt
intern prlgs = do
prlgi <- withStrTable $ \st -> IR.internPrlg st prlgs
underscore <- findAtom "_"
list <- findAtom "[]"
withStrTable $ \st ->
- ( st
- , C.squashVars $ C.variablizePrlg underscore st $ C.desugarPrlg list prlgi)
+ (st, C.squashVars $ C.variablizePrlg underscore st prlgi)
compile :: IR.PrlgInt -> PrlgEnv Code
compile prlgv = do
@@ -58,9 +57,7 @@ expansion noexpand expander output x = do
if expand
then IR.CallI
comma
- [ IR.CallI (IR.str es) [x, IR.VarI (-1) 0]
- , IR.CallI o [IR.VarI (-1) 0]
- ]
+ [IR.CallI (str es) [x, IR.VarI (-1)], IR.CallI o [IR.VarI (-1)]]
else noexpand o x
queryExpansion = expansion (\_ -> id) "expand_query" "call"