diff options
Diffstat (limited to 'app/Compiler.hs')
| -rw-r--r-- | app/Compiler.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/Compiler.hs b/app/Compiler.hs index e9bd7f4..1adefc3 100644 --- a/app/Compiler.hs +++ b/app/Compiler.hs @@ -32,7 +32,7 @@ variablizePrlg :: Int -> [Int] -> PrlgInt -> PrlgInt variablizePrlg void vs (CallI id ps) = CallI id $ map (variablizePrlg void vs) ps variablizePrlg void vs (LiteralI i) - | i == void = VoidI i + | i == void = VoidI | Just idx <- elemIndex i vs = VarI idx i | otherwise = LiteralI i @@ -50,8 +50,8 @@ compileGoal x = compileArg x compileArg :: PrlgInt -> Code compileArg (CallI x args) = U (Struct x) : concatMap compileArg args compileArg (LiteralI x) = [U (Atom x)] -compileArg (VarI x i) = [U (LocalRef x $ Just i)] -compileArg (VoidI i) = [U (VoidRef $ Just i)] +compileArg (VarI x i) = [U (LocalRef x i)] +compileArg (VoidI) = [U VoidRef] seqGoals :: [Code] -> Code seqGoals [] = [NoGoal] |
