Created
April 22, 2018 21:08
-
-
Save sfpgmr/c7ef89bb1a3c579dc6a90fb9d0202a43 to your computer and use it in GitHub Desktop.
オレオレ言語のコンパイルテスト(4)ポストデクリメントや日本語関数名など
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
i32 𩸽(i32 a,i32 b){ | |
return a * b; | |
} | |
export i32 main(){ | |
i32 c = 1,a = 1; | |
if(c != 2){ | |
c = 2; | |
a += c; | |
} else { | |
c = 3; | |
a += c; | |
} | |
c = 𩸽(a--,c); | |
c += a; | |
return c;// 8 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(module | |
(type $𩸽 (func (param i32 i32) (result i32))) | |
(type $main (func (result i32))) | |
(export "main" (func $main)) | |
(func $𩸽 (; 0 ;) (type $𩸽) (param $0 i32) (param $1 i32) (result i32) | |
(return | |
(i32.mul | |
(get_local $0) | |
(get_local $1) | |
) | |
) | |
) | |
(func $main (; 1 ;) (type $main) (result i32) | |
(local $0 i32) | |
(local $1 i32) | |
(set_local $0 | |
(i32.const 1) | |
) | |
(set_local $1 | |
(i32.const 1) | |
) | |
(if | |
(i32.ne | |
(get_local $0) | |
(i32.const 2) | |
) | |
(block | |
(set_local $0 | |
(i32.const 2) | |
) | |
(set_local $1 | |
(i32.add | |
(get_local $1) | |
(get_local $0) | |
) | |
) | |
) | |
(block | |
(set_local $0 | |
(i32.const 3) | |
) | |
(set_local $1 | |
(i32.add | |
(get_local $1) | |
(get_local $0) | |
) | |
) | |
) | |
) | |
(set_local $0 | |
(call $𩸽 | |
(get_local $1) | |
(get_local $0) | |
) | |
) | |
(set_local $1 | |
(i32.sub | |
(get_local $1) | |
(i32.const 1) | |
) | |
) | |
(set_local $0 | |
(i32.add | |
(get_local $0) | |
(get_local $1) | |
) | |
) | |
(set_local $1 | |
(i32.sub | |
(get_local $1) | |
(i32.const 1) | |
) | |
) | |
(return | |
(get_local $0) | |
) | |
(set_local $1 | |
(i32.sub | |
(get_local $1) | |
(i32.const 1) | |
) | |
) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment