summaryrefslogtreecommitdiff
path: root/app/Compiler.hs
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2022-11-15 20:30:53 +0100
committerMirek Kratochvil <exa.exa@gmail.com>2022-11-15 20:30:53 +0100
commite074e454d5f8b5bc5dc45dccab1d138c5cd4ab0c (patch)
tree3d12a566190bdcfa1672a5a5bf69bcc79259b50c /app/Compiler.hs
parent8d5353dc8c7ef3eefb0ae4860e67602c455c1a58 (diff)
downloadprlg-e074e454d5f8b5bc5dc45dccab1d138c5cd4ab0c.tar.gz
prlg-e074e454d5f8b5bc5dc45dccab1d138c5cd4ab0c.tar.bz2
ok simplify the refs back
Diffstat (limited to 'app/Compiler.hs')
-rw-r--r--app/Compiler.hs6
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]