diff options
Diffstat (limited to 'app/Load.hs')
| -rw-r--r-- | app/Load.hs | 13 |
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" |
