From 47ec0d10702be35563f97eeb3999617a2bffe6e3 Mon Sep 17 00:00:00 2001 From: "Matsuura Tomoya(Windows)" Date: Sun, 17 Nov 2024 00:44:13 +0900 Subject: [PATCH] [obsidian] vault backup: 2024-11-17 00:44:13[ --- ...µéšŽè¨ˆç®—を命令型VMインストラクションã§è¡¨ç¾ã™ã‚‹.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/content/多段階計算を命令型VMインストラクションã§è¡¨ç¾ã™ã‚‹.md b/content/多段階計算を命令型VMインストラクションã§è¡¨ç¾ã™ã‚‹.md index 2275e21b..d7931993 100644 --- a/content/多段階計算を命令型VMインストラクションã§è¡¨ç¾ã™ã‚‹.md +++ b/content/多段階計算を命令型VMインストラクションã§è¡¨ç¾ã™ã‚‹.md @@ -26,7 +26,8 @@ decl_levelã§ãƒ¬ãƒ™ãƒ«0ã«ãªã£ãŸã‚‰...ã†ãƒ¼ã‚“ ```ocaml let n = 100 in let m = 200 in - ~( let addc x y = &(~x + ~y) in addc &n &m ) +let addc x y = &(~x + ~y) in + ~(addc &n &m ) ``` `addc`ã®åž‹ã¯`&int -> &int` @@ -37,8 +38,20 @@ Escapeã¯ã‚ãã¾ã§åŸ‹ã‚込むã ã‘ã§è©•ä¾¡ã‚’ã™ã‚‹ã‚ã‘ã˜ã‚ƒãªã„ã‚“ `&(~x + ~y)`ã“ã“ã ã‘å–り出ã™ã¨ã©ã†ã ã‚ㆠ``` +fn addc x y // reg 1,2ã«ã¯ãƒ—ログラム辺ã®ã‚¤ãƒ³ãƒ‡ãƒƒã‚¯ã‚¹ mov 1 x mov 2 y add 1 1 2 //最後ã¯å¿…ãšã“ã†ãªã‚‹ã‚ã‘㧠+ +fn main +movc 1 100 +movc 2 200 + +lift 1 1 +lift 2 2 +startescape +call "addc" 1 2 +endescape +ret 1 ```