diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-02-26 16:58:56 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-02-26 16:58:56 +0100 |
| commit | bb40a4f8ca6d837f3ce85ab49e7d892c96ae6b1c (patch) | |
| tree | 0e478b2301cdcaa35d896629768aa20a0c62d3cd /app/Builtins.hs | |
| parent | 27494c044e54f1bfe8fac466f9416b6e17d58b4d (diff) | |
| download | prlg-bb40a4f8ca6d837f3ce85ab49e7d892c96ae6b1c.tar.gz prlg-bb40a4f8ca6d837f3ce85ab49e7d892c96ae6b1c.tar.bz2 | |
yolo version
Diffstat (limited to 'app/Builtins.hs')
| -rw-r--r-- | app/Builtins.hs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/app/Builtins.hs b/app/Builtins.hs index a12da07..c63fb25 100644 --- a/app/Builtins.hs +++ b/app/Builtins.hs @@ -1,17 +1,6 @@ module Builtins where -import Code - ( Builtin(..) - , Code - , Datum(..) - , Dereferenced(..) - , Instr(..) - , InterpFn - , InterpFn - , derefHeap - , heapStruct - , newHeapVars - ) +import Code (Builtin(..), Code, Datum(..), Instr(..), InterpFn) import CodeLens import qualified Compiler as Co import Control.Exception (IOException, catch) @@ -23,6 +12,7 @@ import Data.List (intercalate) import qualified Data.Map as M import Data.Maybe (fromJust) import Env (PrlgEnv(..), findAtom, findStruct, prlgError) +import Heap (Dereferenced(..), derefHeap, heapStruct, newHeapVars) import qualified IR import Interpreter (backtrack) import Lens.Family2.State @@ -199,8 +189,8 @@ structUnify arity str = do h <- use (cur . heap) scope <- use (cur . hvar) listAtom <- findAtom "[]" + pvars <- newHeapVars arity let hcode = map U $ maybe VoidRef HeapRef . (scope M.!?) <$> [0 .. 2] - (h', pvars) = newHeapVars arity h structData = Struct IR.Id {IR.arity = arity, IR.str = str} : map HeapRef pvars paramsData = @@ -210,7 +200,6 @@ structUnify arity str = do [Atom listAtom] gcode = map U $ structData ++ [Atom str] ++ paramsData zoom cur $ do - heap .= h' gol %= (gcode ++) hed %= (hcode ++) continue |
