Skip to content

Instantly share code, notes, and snippets.

@sfpgmr
sfpgmr / source
Created April 28, 2018 12:30
オレオレ言語のコンパイルテスト(6)for文
export i32 main(){
i32 a = 0;
for(i32 c = 0;c < 4;++c) {
++a;
}
return a;// 4
}
@sfpgmr
sfpgmr / source
Created April 25, 2018 21:17
オレオレ言語のコンパイルテスト(5)while / break 文
i32 𩸽(i32 a,i32 b){
return a * b;
}
export i32 main(){
i32 c = 1,a = 1,b = 0;
if(c != 2){
c = 2;
a += c;
@sfpgmr
sfpgmr / source
Created April 22, 2018 21:08
オレオレ言語のコンパイルテスト(4)ポストデクリメントや日本語関数名など
i32 𩸽(i32 a,i32 b){
return a * b;
}
export i32 main(){
i32 c = 1,a = 1;
if(c != 2){
c = 2;
a += c;
@sfpgmr
sfpgmr / source
Last active April 22, 2018 07:15
オレオレ言語のコンパイルテスト(3)function call
i32 mul(i32 a,i32 b){
return a * b;
}
export i32 main(){
i32 c = 2,a = 2;
// a -= 2;
++a;
@sfpgmr
sfpgmr / compiled.wat
Created April 21, 2018 11:52
オレオレ言語コンパイルテスト(2)
(module
(type $main (func (result i32)))
(export "main" (func $main))
(func $main (; 0 ;) (type $main) (result i32)
(local $0 i32)
(local $1 i32)
(set_local $0
(i32.const 2)
)
(set_local $1
@sfpgmr
sfpgmr / result.wat
Last active April 19, 2018 20:53
オレオレ言語のコンパイルテスト1
(module
(type $main (func (result i32)))
(export "main" (func $main))
(func $main (; 0 ;) (type $main) (result i32)
(local $0 i32)
(local $1 i32)
(set_local $0
(i32.const 2)
)
(set_local $1
@sfpgmr
sfpgmr / index.mjs
Last active April 1, 2018 10:51
四則演算をwasmにコンパイルして実行してみる
import binaryen from 'binaryen';
import tokenize from './tokens.mjs';
import make_parse from './parse.mjs';
import fs from 'fs';
const testSrc =
`
((1 + 2) * 100 + 10) / 10 - 1
`;
@sfpgmr
sfpgmr / .gitignore
Last active May 28, 2017 02:46
WebGL2を試す
.vscode
node_modules
@sfpgmr
sfpgmr / .gitignore
Last active May 21, 2017 09:31
THREE.ShaderMaterial
typings
node_modules
.vscode
temp
@sfpgmr
sfpgmr / .gitignore
Last active May 20, 2017 10:29
ExtrudeGeometry & Texturemap (2)
typings
node_modules
.vscode
temp