Skip to content

Instantly share code, notes, and snippets.

@sfpgmr sfpgmr/source
Created Apr 22, 2018

Embed
What would you like to do?
オレオレ言語のコンパイルテスト(4)ポストデクリメントや日本語関数名など
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
}
(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
You can’t perform that action at this time.