Upgrade to Pro — share decks privately, control downloads, hide ads and more …

mocha - ESNext Transpliler の紹介

mocha - ESNext Transpliler の紹介

古のEcmascript Harmony時代のTransplilerを自作していたので供養します。

Transcript

  1. Mocha ES Harmony Traspiler

  2. Name @brn (ꫬꅿ⨳ⵃ) Occupation ؿٗٝزؒٝسؒٝآص،٥ط؎ذ؍ـؒٝآص، Company Cyberagent ،سذؙأةآؔ AI Messenger

    Blog http://abcdef.gets.b6n.ch/ Twitter https://twitter.com/brn227 GitHub https://github.com/brn
  3. 剑ⴱח闐׵זֽ׸לז׵זְֿהָ֮׶תׅկ ״ֻ罋ִ׋׵ֿ׸כ⳿ؔث単׌׏׋ךדכ 兛鸐ך単⢪׏גְׅתׇ׿

  4. הְֲ׻ֽד㢳ⴓ耀ְג׮ ⡦׮׋׭חז׵זְ涪邌דׅ ׃ַ׮⡲׏׋ך2011/04דׅ ְׅתׇ׿ וֲ׃ג׮⣘균׃׋ַ׏׋׿ׄׯ…

  5. Ecmascript 2017 Ecmascript 2016 Ecmascript 6/2015 E Ec cm ma

    as sc cr ri ip pt t h ha ar rm mo on ny y Ecmascript 5 Ecmascript 3
  6. Harmony鋙ִגתַׅ

  7. Ecmascript 4갽䮲ך穗꿀ַ׵ծ ぐكٝت٦װⰕ⹫ד倜׋ז鎉铂堣腉ך 瘻㹀ח《׶穈׿׌꧊ת׶

  8. 䔲儗ES wikiהְֲل٦آָ㶷㖈׃גֶ׶ծ ׉ֿחproposalהstrawmanהְֲ✳珏겲ך 堣腉فٗه٦ؠٕل٦آָ֮׏׋

  9. ׉׸׾鋅׋䔲儗ך猘כ չزٓٝأػ؎ٓ⡲׏׋׹պ הז׏׋ךד֮׏׋ Babelז׿גת׌זְ

  10. せ⵸כ؝٦ؼ٦אזָ׶ד Mochaח寸㹀װ mochaכ猘ךקֲָ⯓חㄏせ׃׋׿דׅ ذأزخ٦ٕךmocha״׶⯓ח ת֮⚅ח⳿׃גזְַ׵䠐㄂זְֽו

  11. Mocha C++ד剅ְ׋Ecmascript3ַ׵Ecmascript harmonyפךزٓٝأػ ؎ٓ V8׾䵧鯹׃גְ׷ךדreplד㹋ꥷח㢌䳔׃זָ׵㹋遤〳腉

  12. Debuggable SourceMapָ㶷㖈׃גְזְ儗➿׌׏׋ךד ♧遤♧遤ח遤侧הtry-catch׾䮠׬ֿהדرغحؚ׾〳腉ח

  13. function fibonacci(num) {! var a = 1, b = 0,

    temp;! ! while (num >= 0){! temp = a;! a = a + b;! b = temp;! num--;! }! ! return b;! }!
  14. function fibonacci(num) {! try {! __LINE__ = 2;! var a

    = 1,! b = 0,! temp;! ! __LINE__ = 4;! while (num >= 0){! ! __LINE__ = 5;! temp = a;! ! __LINE__ = 6;! a = a+b;! ! __LINE__ = 7;! b = temp;! ! __LINE__ = 8;! num -- ;! }! __LINE__ = 11;! return b;! } catch(__mocha_error){! __Runtime.exceptionHandler(__LINE__, __FILE__, __mocha_error);! }! }! 
  15. Runtime harmonyך葿ղז㢌䳔׾遤ֲ׋׭חRuntime׾欽䠐 Runtimeכⴓⶴׁ׸גֶ׶䗳銲ח䘔ׄגappendׁ׸׷ ׁ׵ח؝ٝػ؎ٕ儗חASTתד㢌䳔ׁ׸׷ךדծ鷄⸇ךزٓٝأ ؿؓ٦ي؝أزכקרئٗ

  16. Transofrm Harmonyך圓俑הStrawmanח֮׏׋劢䱰欽ך،؎ر؍،ך⚕倯׾ 䱰欽

  17. وصُ،ٕכֿֿח http://brn.github.io/mocha/ja/

  18. Ideas 㛇劤涸חכ䩛דػ٦؟׾剅ְג AST׾穈׫甧גגծ׉ַֿ׵AST׾㢌䕎׃גְֻ 剑䖓כת׋AST׾鴬׏גؿ؋؎ٕח剅ֹ⳿׃

  19. Hard to solve ،ٗ٦ꟼ侧ָ꬗⦜ זח׃׹ػة٦ָٝ㢳ְ

  20. // thisを束縛しない関数宣言 foo(x, y, z) -> console.log(this);! // thisを束縛しない関数式 var

    foo = (x, y, z) -> console.log(this);! // thisを束縛する関数宣言 var foo = (x, y, z) => console.log(this);! // thisを束縛する関数式 foo(x,y,z) => console.log(this);!
  21. File watcher ؿ؋؎ٕ湊鋔堣腉׮㣐㢌 windowծlinuxծmacד׉׸׊׸APIָ麩ֲ… 㧅⼿׃גlinuxכInotifyծ׉׸⟃㢩כٕ٦فח׃׋

  22. V8 V8ך⢪ְ倯׮项俱ָ㼰זֻג㣐㢌׌׏׋ أٖحسָ窃׬ה閯ךAbort׾鸬涪ׅ׷׃… ا٦أ铣׬纷湡ח…

  23. libuv ׃ַ׮閯חLibuvתד䵧鯹׃גְגNode.JSךؙٗ٦ٝ׫׋ְז朐䡾 ח…

  24. תה׭ ⡲׷ך㣐㢌׌׏׋ֽו䖤׋׮ךכ㢳ַ׏׋ ֿ׸ד䧭➣דֹתׅ ֿֿח㟌ָ֮׷ https://github.com/brn/mocha