Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
自作言語にモジュールを実装した話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Yuya Kono
December 20, 2020
Programming
480
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
自作言語にモジュールを実装した話
第33回 #hiro_it で発表したスライド
https://github.com/takoeight0821/kagami
Yuya Kono
December 20, 2020
Transcript
16 slides
ࣗ࡞ݴޠʹϞδϡʔϧΛ ࣮ͨ͠ ʹΌʔΜʢ!UBLPFJHIUʣ
ࣗ࡞ݴޠ(SJ f module HelloImport = { import Prelude; main =
{ putStr (String# "hello"#); putStrLn |> { f -> f (String# " world"#) }; }; } ͍ͱ͜ΖΛ࡞ͬͨ
ݴޠ༷ͷઃܭ
จ๏ ϞδϡʔϧΛѻ͏จ๏ʹ͍͔ͭ͘ͷύλʔϯ͕͋Δ #include <stdio.h>ɹϓϦϓϩηοαϨϕϧͰѻ͏ package com.example.hello;ɹτοϓϨϕϧͷએݴͱͯ͠ѻ͏ import java.util.Calendar;ɹͱΓ͋͑ͣ͜ΕΛ࣮͢Δͷ͕ඪ structure
Alist = structɹʢಛผͳҙຯΛ࣋ͭʣͱͯ͠ѻ͏ open List end
จ๏ͷઃܭ w ࣮͕େมͳͷͰɺ࣍ͷػೳޙճ͠ w Ϟδϡʔϧʹผ໊Λ͚ͭΔ w ϞδϡʔϧΛ֊Խ͢Δ w ಛఆͷؔΛΤΫεϙʔτɾΠϯϙʔτ͢Δ͔ΛϓϩάϥϚ͕બͿ $ͷΑ͏ʹɺΠϯϙʔτͨ͠ϞδϡʔϧͰએݴ͞Εͨͯ͢ͷܕؔ
ΛࢀরͰ͖Δɻʢ໊લۭؒʹʮͿͪ·͚Δʯʣ
จ๏ʢϞδϡʔϧͷએݴʣ ϞδϡʔϧΛୈҰڃͷͱͯ͠ѻ͑ͨΒ৭ʑخ͍͕͠ɺ࣮͕େม ݟͨͬΆ͍͚ͲɺΩπ੍͍Λઃ͚Δ͜ͱʹ͢Δ module <Ϟδϡʔϧ໊> = {
<֤छએݴ>; } Λ̍ϑΝΠϧʹ͖͚ͭ̍ͭͩॻ͚Δ
จ๏ʢϞδϡʔϧͷར༻ʣ import Prelude; Prelude.grfͷதΛͯ͢ಡΈࠐΉ import Prelude as P; import
Prelude.Int; Ͱ͖ͳ͍
(SJ f f ͷϞδϡʔϧͷจ๏ module Hello = { -- ϞδϡʔϧHelloͷએݴ
import Prelude; -- ϞδϡʔϧPreludeͷΠϯϙʔτ main = { putStr (String# "hello"#); putStrLn |> { f -> f (String# " world"#) }; }; }
ॲཧܥͷ࣮
࣮ͷํ w Ϟδϡʔϧͷ࣮ʹେ͖͘Θ͚ͯ̎ͭͷύλʔϯ͕͋Δ ιʔείʔυΛ̍ͭʹͭͳ͛Δ ࣮؆୯͕ͩɺιʔείʔυͷαΠζ͕രൃ͔͠Ͷͳ͍ ϦϯΫ࣌·Ͱ֤ϞδϡʔϧΛόϥόϥʹѻ͏
࣮େม͕ͩɺׂίϯύΠϧͰ͖ͯੑೳతʹ༗ར w ࠓճΛ࣮ʢ$ίϯύΠϥΛ࡞ͬͨͱ͖ʹͬͨͷͰʣ
࣮ͷ࡞ઓʢ̍ʣ w Λ؆୯ʹ͢ΔͨΊɺ࣍ͷΑ͏ͳιʔείʔυΛߟ͑Δ NPEVMF$IJME\ JNQPSU1BSFOU ^
$IJME͕1BSFOUΛΠϯϙʔτ͍ͯ͠Δ
࣮ͷ࡞ઓʢ̎ʣ w $IJMEΛίϯύΠϧ͢ΔͨΊʹɺ1BSFOUʹؔ͢ΔҎԼͷใ͕ඞཁ w ܕએݴͷҰཡ w ؔͷܕͷҰཡ w ιʔείʔυ্ͷ໊ؔͱɺ໊લղܾޙͷ໊ؔͷରԠද w
(SJ f f Ͱͷ໊ؔͱɺ--7.*3Ͱͷ໊ؔʢΞηϯϒϥͷϥϕϧ໊ʣͷରԠද w தஔԋࢉࢠͷ݁߹ॱҐͷҰཡ
࣮ͷ࡞ઓʢ̏ʣ w ຖճ1BSFOUͷιʔείʔυΛಡΈऔΔͱඇޮ 1BSFOUͷίϯύΠϧ࣌ʹɺඞཁͳใ͚ͩϝϞ͓ͯ͘͠ w ϝϞ1BSFOUHS f i ʹอଘɻ$ͷϔομϑΝΠϧͷΑ͏ͳΠϝʔδ
ʢਓ͕ؒಡΉඞཁͳ͍ͷͰదʹΤϯίʔυͯ͠อଘ͢Δʣ
ίϯύΠϧͷྲྀΕ 1BSFOUHSGͷίϯύΠϧ 1BSFOUPɺ1BSFOUHS f i ͷੜ $IJMEHSGͷίϯύΠϧ
1BSFOUHS f i ͷಡΈࠐΈ $IJMEPɺ$IJMEHS f i Oͷੜ 1BSFOUPͱ$IJMEPͷϦϯΫ
·ͱΊ w ࣗ࡞ݴޠ(SJ f f ʹϞδϡʔϧΛ࣮ͨ͠ w ͍͔ͭ͘ͷ%FTJHODIPJDF͕͋ͬͨ w จ๏ɺػೳɺ࣮ํ๏
50%0ɿϞδϡʔϧͷґଘؔΛࣗಈͰղܾ͢ΔϏϧυγεςϜ ɹɹɹɹΑΓߴػೳͳϞδϡʔϧͷ࣮ݱ ɹɹɹɹඪ४ϥΠϒϥϦͷඋ
༨ஊ HS f i ϑΝΠϧͷੜʹ)BTLFMMͷγϦΞϥΠζϥΠϒϥϦTFSJBMJ[FΛͬ ͨɻੜ͞ΕͨϑΝΠϧΛݟͯΈΔͱͨΒ͕ଟ͍ɻ Ͳ͏ͯͩ͠Ζ͏ͱߟ͑ͯΈΔͱɺ)BTLFMMͷ$IBSʢจࣈܕʣ6OJDPEF DPEFQPJOUΛද͍ͯ͠ΔɻTFSJBMJ[F͜ΕΛ65'-&ͰΤϯίʔυ͢Δͷ Ͱ͕ଟ͘ͳΔͬΆ͍ɻ
More Decks by Yuya Kono
See All by Yuya Kono
自作プログラミング言語Malgoの紹介
takoeight0821
0
260
プログラミングの暗黙知
takoeight0821
0
150
git logで振り返る大学4年間
takoeight0821
1
230
量子コンピュータで乱数を生成した話
takoeight0821
1
320
自作言語コンパイラを作った話
takoeight0821
0
240
自作言語malgoのコンパイラをリファクタリングした話
takoeight0821
0
430
今日から始める自作コンパイラ ver 0.0.1
takoeight0821
0
1.2k
Language Server Protocolの話
takoeight0821
0
490
GraalVMで遊ぶ
takoeight0821
0
220
Other Decks in Programming
See All in Programming
例外からRich Errorsまで Kotlinエラーハンドリングの進化を読み解く
shiita0903
0
260
テストだけで見つかる? Rubyでつくるメソッド発掘器
izawa
0
180
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
530
数行の変更でDockerビルドを最大91%高速化~GitLab CIの実行基盤を社内40リポジトリに展開するまで~
picopico
4
1.3k
Kawaiicon: Kubernetes, it's no longer cool, but let's secure it anyway!
barnbarn
0
150
Jujutsu で毎日のバージョン管理に「安心」と「直感性」を
oukayuka
0
130
Spec-driven Development with AI
simas
PRO
0
2.3k
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
250
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
220
手の動かし方がわからなかった私が個人開発者になるまで
usagi0920_pochi
0
360
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
260
flutter_test のその先へ — Flutter アプリの LLM 機能に「評価」という品質保証を
kosukesaigusa
0
210
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1.1k
Speed Design
sergeychernyshev
33
2.3k
YesSQL, Process and Tooling at Scale
rocio
174
15k
A Tale of Four Properties
chriscoyier
163
24k
It's Worth the Effort
3n
188
30k
From π to Pie charts
rasagy
1
460
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
350
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
620
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
390
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
23k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
6
970
The Curse of the Amulet
leimatthew05
4
17k