Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
JavaScript実装の自作プログラミング言語をTypeScript実装に移行した話
Search
Keisuke Ikeda
May 22, 2026
Technology
200
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
JavaScript実装の自作プログラミング言語をTypeScript実装に移行した話
https://2026.tskaigi.org/talks/48
Keisuke Ikeda
May 22, 2026
More Decks by Keisuke Ikeda
See All by Keisuke Ikeda
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
180
Docコメントで始める簡単ガードレール
keisukeikeda
1
180
初めてのLisp自作譚
keisukeikeda
0
46
tsconfigのオプションで変わる型世界
keisukeikeda
2
240
Other Decks in Technology
See All in Technology
Making sense of Google’s agentic dev tools
glaforge
1
290
ガバナンスの「ちょうどいい落とし所」を探れ!開発スピードを妨げない運用判断の勘所 / SRE NEXT 2026
genda
1
270
Alphaモジュール使っていいのかい!?いけないのかい!?どっちなんだいっ!?
watany
1
300
Type-safe IaC for Dart
coborinai
0
170
マルチアカウント環境でSecurity Hubの運用、その後どうなった? / SRE NEXT 2026 miniLT会
genda
0
110
AIが当たり前の組織で エンジニアはどう育つか
nishihira
1
530
「守りたい体験」を渡すだけで E2E を生成させられるようになった話
hinac0
1
900
誤解だらけの開発生産性 / Myths and Misconceptions about Developer Productivity
i35_267
2
920
生成AI×AWS CDK×AWS FISで"振り返れる"ミニGameDayをつくろう
yoshimi0227
1
470
SoccerMaster: A Vision Foundation Model for Soccer Understanding
kzykmyzw
0
150
生成 AI 時代にいま一度「問い合わせ」について考えてみる
kazzpapa3
1
100
AI Coding Agent時代のcdk-nagガードレール 〜組織ルールを強制CIで守り抜く設計の挑戦〜
mhrtech
3
460
Featured
See All Featured
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
A Modern Web Designer's Workflow
chriscoyier
698
190k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Deep Space Network (abreviated)
tonyrice
0
230
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
390
Statistics for Hackers
jakevdp
799
230k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.4k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
640
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
350
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.4k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
Transcript
+BWB4DSJQU࣮ͷ ࣗ࡞ϓϩάϥϛϯάݴޠΛ 5ZQF4DSJQU࣮ʹҠߦͨ͠ ,FJTVLF*LFEB 54,BJHJ !JLF@LFJDIBO
自己紹介 02/14 ɾ౦ژͱؔʢେࡕ&ژʣͷ2ڌੜ׆த ɾTSKaigi 2025,2026 / ϑϩϯτΤϯυΧϯϑΝϨϯεؔ 2025,2026 ɹ3FBDU5PLZPϑΣεͷελοϑ ɾษڧձ/ΧϯϑΝϨϯεେ͖Ϛϯ,
ΠϕϯτதͷπΠʔτ͕͏Δ͍͞ ɾࠓɺ࢈·Εͨ໑ͱै໑͕͔Θ͍͍ͱࢥ͍ͬͯΔ !JLF@LFJDIBO ,FJTVLF*LFEB
tsconfigに向き合おう! 03/14 ͜ͷൃදͰߦ͏͜ͱ ✅ ͢Δ͜ͱ ɾJS → TSҠߦͷ࣮ମݧ ɾݴޠ࣮ͱ͍͏υϝΠϯͰͷTSͷخ͔ͬͨ͠ɺͭ·͍ͮͨ 🚫
ɾࣗ࡞ͨ͠ݴޠɺࣗ࡞ͷϞσϧʹͨ͠ݴޠɺݴޠॲཧܥͷৄ͍͠ ɾTypeScript ͷجຊతͳ͍ํͷઆ໌ !JLF@LFJDIBO
前提知識 04/14 Έͳ͞Μ ϓϩάϥϛϯάݴޠ ݴޠॲཧܥ ࣗ࡞ͨ͜͠ͱ͋Γ·͔͢ʁ !JLF@LFJDIBO
前提知識 05/14 ɾ1958 John McCarthy ͞ΜͷจͰൃද ɾؔܕϓϩάϥϛϯάݴޠͷϧʔπ ɾߏจ͕ඇৗʹγϯϓϧɿS ࣜʢલஔه๏ʣ ɹˠ
ࣗ࡞ϓϩάϥϛϯάݴޠɾݴޠॲཧܥͷೖʹ࠾༻͞Ε͍͢ ࣗ࡞ݴޠͷϞσϧ-JTQʹ͍ͭͯ !JLF@LFJDIBO (+ 1 2) (* (+ 3 4) (- 10 (* 2 3)))
前提知識 06/14 ίʔυ͕ಈ͘·Ͱ !JLF@LFJDIBO ιʔεจࣈྻ (* (+ 3 4) (-
10 (* 2 3))) ࣈ۟ղੳʢLexerʣ τʔΫϯྻ [ *, (, +, 3, 4, ), (, -, 10, ... ] ߏจղੳʢParserʣ ASTʢߏʣ * + - 3 4 10 ... ධՁʢEvaluatorʣ 28
JSで苦しんだ話 07/14 +4Ͱۤ͠Μͩ index.js const eval = (node, env) =>
{ // node は以下のいずれか: // number | string | symbol(識別子)| list | nil // // JS は引数に型を持たない // 型の検証はすべて実行時 };
JSで辛かった話 08/14 ܕͷෆҰக͕ index.js const eval = (node, env) =>
{ if (node.type === "number") return node.value; if (node.type === "list") return apply(evaluate(node.car, env), node.cdr); // symbol(識別子)の処理が抜けている // return 文なし → undefined を返す // → apply の第1引数が undefined に // → 再帰の数段後で TypeError };
TSに移行して 09/14 !JLF@LFJDIBO ܕʹΑΔදݱ // BNF <value> ::= <number> |
<string> | <symbol> | <list> | nil // TypeScript type LispValue = number | string | Symbol | Cons | null; ɾBNFʢBackus-Naur Formʣɿݴޠͷจ๏Λܗࣜతʹهड़͢Δه๏ ɾBNF ͷ"|" TypeScript ͷϢχΦϯܕܕʢSum TypeʣΛදݱ ɾݴޠ࣮ͱ͍͏ෳࡶͳυϝΠϯʹରԠ͍͢͠
TSに移行して 10/14 !JLF@LFJDIBO 5ZQF4DSJQUͷ/BSSPXJOHʢ௨ৗ࣌ʣ index.ts // ローカル変数:TypeScript が正確に追跡できる let token:
string | null = null; token = "hello"; token.toUpperCase(); // ✓ string と確定 token = null; token.toUpperCase(); // ✗ コンパイルエラー:null の可能性
TSに移行して 11/14 !JLF@LFJDIBO 5ZQF4DSJQUͷ/BSSPXJOHʢDMBTTʣ index.ts class Lexer { private token:
string | null = null; private readNext(): void { this.token = "hello"; // フィールドを書き換える副作用 } next(): void { this.token = null; // TypeScript:token は null と記録 // ... // readNext() の中身は解析しない // → this.token が書き換わることを TypeScript は追跡できない } }
TSに移行して 12/14 !JLF@LFJDIBO 54Ͱۤ͠Μͩ index.ts class Parser { private current:
LispValue = null; // 完成したトークンを格納 private state: number = 0; private consume(): void { // 1文字読み進め、トークンが完成したら this.current に格納 } nextToken(): LispValue { this.current = null; // ① TypeScript:current は null と記録 while (!this.done()) { if (this.current !== null) break; // ② TypeScript:常に false と警告 this.consume(); // ③ this.current を書き換えるが追跡されない } return this.current; } }
TSに移行して 13/14 !JLF@LFJDIBO 54ͱͯ͠ਖ਼͍͠001ઃܭ index.ts class Parser { private current:
LispValue = null; // 完成したトークンを格納 private state: number = 0; private consume(): void { // 1文字読み進め、トークンが完成したら this.current に格納 } nextToken(): LispValue { this.current = null; // ① TypeScript:current は null と記録 while (!this.done()) { if (this.current !== null) break; // ② TypeScript:常に false と警告 this.consume(); // ③ this.current を書き換えるが追跡されない } return this.current; } }
まとめ 14/14 !JLF@LFJDIBO ·ͱΊ ɾ+4࣮࣌ܕͷෆҰக͕VOEFGJOFEͱͯ͠੩͔ʹͤ͞ΔɻΤϥʔͷ ɹݪҼՕॴͱൃੜՕॴ͕ͣΕͯਏ͍😭 ɾจ๏هड़ʢ#/'ʣͱϢχΦϯܕܕʢ4VN5ZQFʣͱͯ͠ࣅͨߏΛ ɹ࣋ͭɻܕʹΑΔ੍Ͱ࣮ߦલʹʹؾ͚ͮΔ😎 ɾ/BSSPXJOHϝιουݺͼग़͠ޙͷϑΟʔϧυมߋΛ͠ͳ͍ɻ001 ɹͷঢ়ଶཧͱিಥ͢Δ😵
宣伝 ϑϩϯτΤϯυΧϯϑΝϨϯεؔ 2026 ଓใSNSͰ֬ೝͯ͠ʙ X note