diff --git a/app/Compiler.hs b/app/Compiler.hs index e0f89e5..1b7dd8c 100644 --- a/app/Compiler.hs +++ b/app/Compiler.hs @@ -92,13 +92,6 @@ handleSymbol h (ZorthASTWord "/") = do \ push rax\n" return () -handleSymbol h (ZorthASTWord "ret") = do - liftIO $ hPutStr h - " mov rax,60\n\ - \ mov rdi,0\n\ - \ syscall\n" - return () - handleSymbol h (ZorthASTWord "dup") = do liftIO $ hPutStr h " pop rax\n\ @@ -138,6 +131,10 @@ handleSymbol h (ZorthASTWord "=") = do liftIO $ truthOperator h "sete" return () +handleSymbol h (ZorthASTWord "/=") = do + liftIO $ truthOperator h "setne" + return () + handleSymbol h (ZorthASTWord ">") = do liftIO $ truthOperator h "setg" return () @@ -223,4 +220,7 @@ compileZorth :: Handle -> ZorthAST -> IO () compileZorth _ [] = return () compileZorth h xs = do forthPrelude h - compileZorthAST h xs $ Environment 0 M.empty \ No newline at end of file + compileZorthAST h xs $ Environment 0 M.empty + hPutStr h " mov rax,60\n\ + \ mov rdi,0\n\ + \ syscall\n" \ No newline at end of file diff --git a/examples/69420.zorth b/examples/69420.zorth index cc53565..0a1d64d 100644 --- a/examples/69420.zorth +++ b/examples/69420.zorth @@ -23,5 +23,3 @@ while fi 1+ repeat - -ret \ No newline at end of file diff --git a/examples/fib.zorth b/examples/fib.zorth index 459fc6a..75fe185 100644 --- a/examples/fib.zorth +++ b/examples/fib.zorth @@ -16,5 +16,3 @@ ; 15 fib - -ret