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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Keisuke Ikeda
May 22, 2026
Technology
180
1
Share
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
160
Docコメントで始める簡単ガードレール
keisukeikeda
1
160
初めてのLisp自作譚
keisukeikeda
0
35
tsconfigのオプションで変わる型世界
keisukeikeda
2
230
Other Decks in Technology
See All in Technology
「気づいたら仕事が終わっている」バクラクAIエージェント本番運用の裏側 / layerx-bakuraku-aie2026
yuya4
18
9.7k
Databricks 月刊サービスアップデート 2026年05月号
tyosi1212
0
200
運用を見据えたAIエージェント設計実践
amacbee
1
2.7k
JJUG CCC 2026 Spring AI時代の開発こそ標準化を武器に! ― 方式・プロセス・プラットフォームの標準化
s27watanabe
2
710
noUncheckedIndexedAccess、3時間、1万円。 / noUncheckedIndexedAccess, 3 Hours, 10,000 JPY.
kaonavi
1
270
AI と創る新たな世界 / A New World Created with AI
ks91
PRO
0
110
BigQuery の Cross-cloud Lakehouse への歩み
phaya72
2
540
Oracle AI Database@AWS:サービス概要のご紹介
oracle4engineer
PRO
4
2.8k
Claude code Orchestra
ozakiomumkj
3
940
そのPoC、何を検証したつもりでしたか? AIプロダクトの価値検証で陥った落とし穴
techtekt
PRO
0
140
実装は速くなった、レビューはどうする? ― 自身のレビューをAIで再現させるサーヴァントエンジニアリングのすゝめ / Implementation got faster. So what about reviews? — An invitation to Servant Engineering: Recreating your own code reviews with AI
nrslib
6
3.6k
AIを「創る」と「使う」の循環 — HRテックが実践するリアルなAI組織実装
taketo957
0
1.4k
Featured
See All Featured
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
130
Code Review Best Practice
trishagee
74
20k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.6k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Designing Powerful Visuals for Engaging Learning
tmiket
1
400
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.5k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
150
Context Engineering - Making Every Token Count
addyosmani
9
940
Deep Space Network (abreviated)
tonyrice
0
160
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