[obsidian] vault backup: 2024-11-17 01:44:15[
All checks were successful
Build / build (push) Successful in 3m19s
All checks were successful
Build / build (push) Successful in 3m19s
This commit is contained in:
parent
47ec0d1070
commit
3b53c3c901
@ -30,27 +30,34 @@ let addc x y = &(~x + ~y) in
|
||||
~(addc &n &m )
|
||||
```
|
||||
|
||||
`addc`の型は`&int -> &int`
|
||||
`addc`の型は`(&int,&int) -> &int`
|
||||
|
||||
CodeもEscapeもネストできる構造なんだから命令型に直すとなにかしらのスタック構造を操作するものになるはず
|
||||
Escapeはあくまで埋め込むだけで評価をするわけじゃないんだよな
|
||||
|
||||
`&(~x + ~y)`ここだけ取り出すとどうだろう
|
||||
|
||||
`~x`はxを評価した後にエスケープする、ってことだもんなあ
|
||||
|
||||
```
|
||||
fn addc x y // reg 1,2にはプログラム辺のインデックス
|
||||
startescape
|
||||
mov 1 x
|
||||
endescape
|
||||
startescape
|
||||
mov 2 y
|
||||
endescape
|
||||
add 1 1 2 //最後は必ずこうなるわけで
|
||||
|
||||
fn main
|
||||
movc 1 100
|
||||
movc 2 200
|
||||
|
||||
lift 1 1
|
||||
lift 2 2
|
||||
lift 2 1
|
||||
lift 3 2
|
||||
startescape
|
||||
call "addc" 1 2
|
||||
move 1 "addc"
|
||||
call 1 2 1
|
||||
endescape
|
||||
ret 1
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user