SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
Stone 第10週
N. Shimizu (chiko@tom.sfc.keio.ac.jp / @chikoski)
今週の進
•   変数の宣言ができるようになった

•   再帰呼び出しできるようになった!

    •   環境の退避が問題だった

    •   関数呼び出しの評価時に退避するようにした

•   関数の中で関数を定義できるようになった
再帰呼び出し


def fact(n){                 fact(10)
    ret = 1
    if(n > 1){
        prev = fact(n - 1)
        ret = prev * n
    }
    ret
}
関数内で定義されている関数


def main(n){                 def add(a, b){
  var i = 0;                     a + b + c;
  var c = 1;                 }
  var ret = 0;           }
  while(i < n){
    ret = add(ret, i);   main(10);
    i=i+1
  }
  ret
外側のブロックの変数を参照できる


def main(n){          def add(a, b){
  var i = 0;    これを参照 a + b + c;
  var c = 1;             }
  var ret = 0;         }
  while(i < n){
    ret = add(ret, i); main(10);
    i=i+1
  }
  ret
静的スコープ


def main(n){          def add(a, b){
  var i = 0;    これを参照 a + b + c;
  var c = 1;             }
  var ret = 0;         }
  while(i < n){
    ret = add(ret, i); main(10);
    i=i+1
  }
  ret
To Do
•   関数内で定義された関数の再帰呼び出しは
    できるのか確認する

•   関数内で定義された二つの関数の、
    相互の呼び出しができるかどうかを確認する
今後の野望
言語仕様的な野望


•   高階関数

•   無名関数

•   関数を返す関数

•   継続

•   文脈に応じた評価(null など)

•   オブジェクト指向
言語仕様的な野望(つづき)


•   データ型をつくれるようにする

    •   配列、リスト

    •   ハッシュ

•   記号処理、文字列処理

•   return 文をつくる

•   Scheme への変換
開発環境的な野望


•   ブラウザ上でのプログラミング

    •   評価器、構文解析器のWeb API化

    •   エディタ?

•   ビジュアルプログラミング言語

•   内部の可視化

•   あと何かありますかねー

Contenu connexe

Plus de Noritada Shimizu

20150512 webgl-off-the-main-thread
20150512 webgl-off-the-main-thread20150512 webgl-off-the-main-thread
20150512 webgl-off-the-main-threadNoritada Shimizu
 
asm.js x emscripten: The foundation of the next level Web games
asm.js x emscripten: The foundation of the next level Web gamesasm.js x emscripten: The foundation of the next level Web games
asm.js x emscripten: The foundation of the next level Web gamesNoritada Shimizu
 
Mozilla とブラウザゲーム
Mozilla とブラウザゲームMozilla とブラウザゲーム
Mozilla とブラウザゲームNoritada Shimizu
 
2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.js2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.jsNoritada Shimizu
 
20151128 firefoxos-handson
20151128 firefoxos-handson20151128 firefoxos-handson
20151128 firefoxos-handsonNoritada Shimizu
 
Inspection & Tweak: Firefox を使ったフロント開発
Inspection & Tweak: Firefox を使ったフロント開発Inspection & Tweak: Firefox を使ったフロント開発
Inspection & Tweak: Firefox を使ったフロント開発Noritada Shimizu
 
20150829 firefox-os-handson
20150829 firefox-os-handson20150829 firefox-os-handson
20150829 firefox-os-handsonNoritada Shimizu
 
20150727 Development tools for Firefox OS apps
20150727 Development tools for Firefox OS apps20150727 Development tools for Firefox OS apps
20150727 Development tools for Firefox OS appsNoritada Shimizu
 
Firefox OS でアプリを作るときに気をつけたい N 個のこと
Firefox OS  でアプリを作るときに気をつけたい N 個のことFirefox OS  でアプリを作るときに気をつけたい N 個のこと
Firefox OS でアプリを作るときに気をつけたい N 個のことNoritada Shimizu
 
Firefox OSアプリ開発ハンズオン(Hello World編)
Firefox OSアプリ開発ハンズオン(Hello World編)Firefox OSアプリ開発ハンズオン(Hello World編)
Firefox OSアプリ開発ハンズオン(Hello World編)Noritada Shimizu
 
WebVR(html5j TV部、WebVRとかVRのUIとか勉強会)
WebVR(html5j TV部、WebVRとかVRのUIとか勉強会)WebVR(html5j TV部、WebVRとかVRのUIとか勉強会)
WebVR(html5j TV部、WebVRとかVRのUIとか勉強会)Noritada Shimizu
 
Application submission, management and manetization in Firefox Marketplace
Application submission, management and manetization in Firefox MarketplaceApplication submission, management and manetization in Firefox Marketplace
Application submission, management and manetization in Firefox MarketplaceNoritada Shimizu
 
つくろう!Firefox OS アプリ
つくろう!Firefox OS アプリつくろう!Firefox OS アプリ
つくろう!Firefox OS アプリNoritada Shimizu
 
20150118 firefoxos-handson-helloworld
20150118 firefoxos-handson-helloworld20150118 firefoxos-handson-helloworld
20150118 firefoxos-handson-helloworldNoritada Shimizu
 

Plus de Noritada Shimizu (20)

20160601 devtools
20160601 devtools20160601 devtools
20160601 devtools
 
20150512 webgl-off-the-main-thread
20150512 webgl-off-the-main-thread20150512 webgl-off-the-main-thread
20150512 webgl-off-the-main-thread
 
20160428 html5jwebplat
20160428 html5jwebplat20160428 html5jwebplat
20160428 html5jwebplat
 
asm.js x emscripten: The foundation of the next level Web games
asm.js x emscripten: The foundation of the next level Web gamesasm.js x emscripten: The foundation of the next level Web games
asm.js x emscripten: The foundation of the next level Web games
 
Mozilla とブラウザゲーム
Mozilla とブラウザゲームMozilla とブラウザゲーム
Mozilla とブラウザゲーム
 
2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.js2016 gunma.web games-and-asm.js
2016 gunma.web games-and-asm.js
 
20151224-games
20151224-games20151224-games
20151224-games
 
20151128 firefoxos-handson
20151128 firefoxos-handson20151128 firefoxos-handson
20151128 firefoxos-handson
 
20151117 devtools
20151117 devtools20151117 devtools
20151117 devtools
 
Inspection & Tweak: Firefox を使ったフロント開発
Inspection & Tweak: Firefox を使ったフロント開発Inspection & Tweak: Firefox を使ったフロント開発
Inspection & Tweak: Firefox を使ったフロント開発
 
20150822 osc-shimane
20150822 osc-shimane20150822 osc-shimane
20150822 osc-shimane
 
20150829 firefox-os-handson
20150829 firefox-os-handson20150829 firefox-os-handson
20150829 firefox-os-handson
 
20150829 firefox-os
20150829 firefox-os20150829 firefox-os
20150829 firefox-os
 
20150727 Development tools for Firefox OS apps
20150727 Development tools for Firefox OS apps20150727 Development tools for Firefox OS apps
20150727 Development tools for Firefox OS apps
 
Firefox OS でアプリを作るときに気をつけたい N 個のこと
Firefox OS  でアプリを作るときに気をつけたい N 個のことFirefox OS  でアプリを作るときに気をつけたい N 個のこと
Firefox OS でアプリを作るときに気をつけたい N 個のこと
 
Firefox OSアプリ開発ハンズオン(Hello World編)
Firefox OSアプリ開発ハンズオン(Hello World編)Firefox OSアプリ開発ハンズオン(Hello World編)
Firefox OSアプリ開発ハンズオン(Hello World編)
 
WebVR(html5j TV部、WebVRとかVRのUIとか勉強会)
WebVR(html5j TV部、WebVRとかVRのUIとか勉強会)WebVR(html5j TV部、WebVRとかVRのUIとか勉強会)
WebVR(html5j TV部、WebVRとかVRのUIとか勉強会)
 
Application submission, management and manetization in Firefox Marketplace
Application submission, management and manetization in Firefox MarketplaceApplication submission, management and manetization in Firefox Marketplace
Application submission, management and manetization in Firefox Marketplace
 
つくろう!Firefox OS アプリ
つくろう!Firefox OS アプリつくろう!Firefox OS アプリ
つくろう!Firefox OS アプリ
 
20150118 firefoxos-handson-helloworld
20150118 firefoxos-handson-helloworld20150118 firefoxos-handson-helloworld
20150118 firefoxos-handson-helloworld
 

2週間できる!スクリプト言語の作り方 第10回

  • 1. Stone 第10週 N. Shimizu (chiko@tom.sfc.keio.ac.jp / @chikoski)
  • 2. 今週の進 • 変数の宣言ができるようになった • 再帰呼び出しできるようになった! • 環境の退避が問題だった • 関数呼び出しの評価時に退避するようにした • 関数の中で関数を定義できるようになった
  • 3. 再帰呼び出し def fact(n){ fact(10) ret = 1 if(n > 1){ prev = fact(n - 1) ret = prev * n } ret }
  • 4. 関数内で定義されている関数 def main(n){ def add(a, b){ var i = 0; a + b + c; var c = 1; } var ret = 0; } while(i < n){ ret = add(ret, i); main(10); i=i+1 } ret
  • 5. 外側のブロックの変数を参照できる def main(n){ def add(a, b){ var i = 0; これを参照 a + b + c; var c = 1; } var ret = 0; } while(i < n){ ret = add(ret, i); main(10); i=i+1 } ret
  • 6. 静的スコープ def main(n){ def add(a, b){ var i = 0; これを参照 a + b + c; var c = 1; } var ret = 0; } while(i < n){ ret = add(ret, i); main(10); i=i+1 } ret
  • 7. To Do • 関数内で定義された関数の再帰呼び出しは できるのか確認する • 関数内で定義された二つの関数の、 相互の呼び出しができるかどうかを確認する
  • 9. 言語仕様的な野望 • 高階関数 • 無名関数 • 関数を返す関数 • 継続 • 文脈に応じた評価(null など) • オブジェクト指向
  • 10. 言語仕様的な野望(つづき) • データ型をつくれるようにする • 配列、リスト • ハッシュ • 記号処理、文字列処理 • return 文をつくる • Scheme への変換
  • 11. 開発環境的な野望 • ブラウザ上でのプログラミング • 評価器、構文解析器のWeb API化 • エディタ? • ビジュアルプログラミング言語 • 内部の可視化 • あと何かありますかねー