summaryrefslogtreecommitdiff
path: root/app/Load.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-03-10 19:18:30 +0100
committerMirek Kratochvil <exa.exa@gmail.com>2023-03-10 19:18:30 +0100
commit452cd4949605f4370e4aed4d54bc23d71ca0ecfb (patch)
tree3a722b5fa1f25351fa33c6618a23f0dfc2eca448 /app/Load.hs
parentf61d6a0179e901717fbf3153282ecd4990db0108 (diff)
downloadprlg-452cd4949605f4370e4aed4d54bc23d71ca0ecfb.tar.gz
prlg-452cd4949605f4370e4aed4d54bc23d71ca0ecfb.tar.bz2
compiler can compile errors
Diffstat (limited to 'app/Load.hs')
-rw-r--r--app/Load.hs9
1 files changed, 3 insertions, 6 deletions
diff --git a/app/Load.hs b/app/Load.hs
index 5a482fd..440c160 100644
--- a/app/Load.hs
+++ b/app/Load.hs
@@ -31,16 +31,13 @@ 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 prlgi)
-compile :: IR.PrlgInt -> PrlgEnv Code
+compile :: IR.PrlgInt -> ExceptT String PrlgEnv Code
compile prlgv = do
- comma <- findAtom ","
- semi <- findAtom ";"
- cut <- findAtom "!"
- return $ C.compileGoals comma semi cut prlgv
+ [comma, semi, cut] <- lift $ traverse findAtom [",", ";", "!"]
+ except $ C.compileGoals comma semi cut prlgv
expansion ::
(Int -> IR.PrlgInt -> IR.PrlgInt)