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
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
ChatworkとBPaaS 異なる特性で学んだAI機能開発の ベストプラクティス
kubell_hr
2
2.6k
チームで実践する AI-DLC 思考の軌跡を残すチェックポイント設計
belongadmin
0
2.5k
DevOps Agentで始めるAWS運用 〜フロンティアエージェントが変える運用の現場〜
nyankotaro
1
170
JJUG CCC 2026 Spring AI時代の開発こそ標準化を武器に! ― 方式・プロセス・プラットフォームの標準化
s27watanabe
2
710
PHP と TypeScript の型システム比較:AI 時代の「型」は誰のためにあるのか? #frontend_phpcon_do / frontend_phpcon_do_2026
shogogg
1
240
Diagnosing performance problems without the guesswork
elenatanasoiu
0
160
先取りMaven4 ~16年ぶりのメジャーアップデート、その進化とは?~
ogiwarat
0
140
ポスター発表&デモと総括 / Poster Presentations & Demonstrations and Summary
ks91
PRO
0
190
OCI Oracle AI Database Services新機能アップデート(2026/03-2026/05)
oracle4engineer
PRO
0
210
はじめてのDatadog
kairim0
0
270
AI フレンドリーなエラー監視を TypeScript で実現する
shinyaigeek
2
250
「速く作る」から「正しく作る」へ ─ 生成AI時代の開発フロー改革の ロードマップと実行 ─
starfish719
0
6.9k
Featured
See All Featured
How to build a perfect <img>
jonoalderson
1
5.6k
Raft: Consensus for Rubyists
vanstee
141
7.5k
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
770
Designing Experiences People Love
moore
143
24k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
150
Context Engineering - Making Every Token Count
addyosmani
9
940
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
840
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
320
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
210
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
220
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