TURING COMPLETE!

This commit is contained in:
2025-09-09 18:58:26 +01:00
parent b84f5f5e53
commit e440585f90
3 changed files with 106 additions and 5 deletions

View File

@@ -99,6 +99,18 @@ handleSymbol h (ZorthASTWord "dup") = do
\ push rax\n"
return ()
handleSymbol h (ZorthASTWord "display") = do
liftIO $ hPutStr h
" push rsp\n\
\ mov rbp, rsp\n\
\ mov rax, 1\n\
\ mov rdi, 1\n\
\ mov rsi, [rbp]\n\
\ mov rdx, 1\n\
\ syscall\n\
\ pop rsp\n\
\ add rsp, 8\n"
return ()
handleSymbol h (ZorthASTWord "mem") = do
liftIO $ hPutStr h
@@ -172,7 +184,7 @@ handleSymbol h (ZorthASTWord "<=") = do
handleSymbol h (ZorthASTWord w) = do
state <- get
liftIO $ compileZorthAST h ((environment state) M.! w) state -- parent env to child and discard
_ <- compileZorthASTState h ((environment state) M.! w) -- parent env to child and discard
return ()
handleSymbol _ (ZorthASTWordDecl (name,ast)) = do