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
DSL でナンデモプログラミング!? / dsl-programming
Search
Watson
October 13, 2016
Programming
2
9.1k
DSL でナンデモプログラミング!? / dsl-programming
TeX と Vim script を比較してみた
Watson
October 13, 2016
Tweet
Share
More Decks by Watson
See All by Watson
Recent Status of the TeX Community in Japan / bachotex2025
wtsnjp
1
90
LaTeX News斜め読み / texconf2024-ltnews
wtsnjp
0
200
Texdocのしくみ / texconf2024-texdoc
wtsnjp
0
110
数式識別子の文書内曖昧性の解消 / nlp2024
wtsnjp
0
45
Building Dataset for Grounding of Formulae — Annotating Coreference Relations Among Math Identifiers / lrec2022
wtsnjp
0
200
MioGatto による数式グラウンディング データセットの構築 / nlp2022
wtsnjp
0
600
MioGatto: A Math Identifier-oriented Grounding Annotation Tool / mathui2021
wtsnjp
0
400
日本語化プロジェクト 〜TeX Live と learnlatex.org〜 / localize
wtsnjp
0
1.4k
Dataset Creation for Grounding of Formulae / SCIDOCA2020
wtsnjp
0
420
Other Decks in Programming
See All in Programming
未来を拓くAI技術〜エージェント開発とAI駆動開発〜
leveragestech
2
180
あなたとJIT, 今すぐアセンブ ル
sisshiki1969
1
730
あのころの iPod を どうにか再生させたい
orumin
2
2.5k
UbieのAIパートナーを支えるコンテキストエンジニアリング実践
syucream
2
720
CSC305 Summer Lecture 05
javiergs
PRO
0
110
モバイルアプリからWebへの横展開を加速した話_Claude_Code_実践術.pdf
kazuyasakamoto
0
260
Dart 参戦!!静的型付き言語界の隠れた実力者
kno3a87
0
210
AIでLINEスタンプを作ってみた
eycjur
1
200
AI OCR API on Lambdaを Datadogで可視化してみた
nealle
0
180
Claude Codeで挑むOSSコントリビュート
eycjur
0
180
ソフトウェアテスト徹底指南書の紹介
goyoki
1
110
Flutter로 Gemini와 MCP를 활용한 Agentic App 만들기 - 박제창 2025 I/O Extended Seoul
itsmedreamwalker
0
150
Featured
See All Featured
A better future with KSS
kneath
239
17k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Raft: Consensus for Rubyists
vanstee
140
7.1k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Six Lessons from altMBA
skipperchong
28
4k
Faster Mobile Websites
deanohume
309
31k
Documentation Writing (for coders)
carmenintech
73
5k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Statistics for Hackers
jakevdp
799
220k
Building a Scalable Design System with Sketch
lauravandoore
462
33k
Scaling GitHub
holman
462
140k
Code Review Best Practice
trishagee
70
19k
Transcript
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ DSL ͰφϯσϞϓϩάϥϛϯάʂʁ ʙTEX ͱ Vim script Λൺֱͯ͠Έͨʙ ϫτιϯ
(@Watson_DNA) Yokohama.vim #8 2016 10 ݄ 16 1 / 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ ࣗݾհ ϫτιϯ (@Watson_DNA) ▶ T େֶ ཧֶ෦
ੜใՊֶՊ ˠจࣈྻॲཧֶՊʹओʹྻղੳ ▶ ߴߍ࣌ࢠੜֶΛѪ͍ͯͨ͠ ˠ͍·ֶใՊֶʹڵຯ͕Ҡߦ ▶ झຯొࢁʢΫϥΠϛϯάొΓؚΉʣ ˠࠓઇࢁߦ͖͍ͨɽ໋͕͍ͭ͋ͬͯ͘Γͳ͍ ▶ ͪΖΜϓϩάϥϛϯά͖ େ͖ͳݴޠɿTEX (on L A TEX), Ruby ͬͨ͜ͱ͋ΔݴޠɿC/C++, R, Python, Scheme, etc. ▶ Vim ઓಆྗ 315ʢ2016 10 ݄ 16 ݱࡏʣ 2 / 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ DSL ͱ ఆٛ C Python ͳͲͷϓϩάϥϛϯάݴޠΛʮ൚༻ݴޠʯͱݺͿͷʹ ର͠ɼ͋ΔಛఆͷछྨͷʹಛԽͨ͠ίϯϐϡʔλݴޠΛ
DSL ʢDomain Specific Language ʹυϝΠϯಛԽݴޠʣͱݺͿɽ ྫ ▶ ϋʔυΣΞهड़ɿVerilog, VHDL ▶ Ϗϧυπʔϧɿmake, Rake ▶ ͦͷଞɿAWK, HTML/CSS, SQL, yacc, VBA ͳͲͳͲ ͪΖΜɼ൛ݴޠ TEX Vim script DSL ʹؚ·ΕΔʂ DSL + φϯσϞϓϩάϥϛϯά = τϯσϞϓϩάϥϛϯάʂʁ 3 / 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ TEX ݴޠͱ TEXʢTeX; ςϑ, ςοΫʣ ΞϝϦΧͷֶऀ Knuth ͕ࣗஶ
The Art of Computer Programming Λ൛͢ΔͨΊ 1976 ʹߟҊͨ͠൛ιϑτΣΞɽಛʹࣜ ͷॲཧʢ ඒ͠͞ʣʹఆධ͕͋Δɽ ζ(s) = ∞ ∑ n=1 1 ns = ∏ p:prime 1 1 − p−s ▶ Ұൠʹ L A TEX ͷϚΫϩύοέʔδΛಡΈࠐ·ͤͯ͏ ▶ εϥΠυ༻ͷ Beamer ͱ͍͏จॻΫϥεʢຊࢿྉ͕࣮ྫʣ ˠ Vim ͰεϥΠυ࡞Մೳʂ Vimmer ͷօ͞ΜʹΦεεϝʂ ▶ ൛ʹಛԽͨ͠ DSLʢTEX ݴޠʣͷΠϯλϓϦλͰ͋Δ ▶ TEX ݴޠνϡʔϦϯάશੑΛͭ 4 / 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ Vim script ͱʢऍՠʹઆ๏ʣ VimʢVi IMproved; ϰΟϜ, ϰΟΞΠΤϜʣ ΦϥϯμͷϓϩάϥϚ
Moolenaar ʹΑͬͯ 1980 ʹ։ൃ͞ΕͨςΩετΤσΟλɽ ಛʹϓϩάϥϚͷؒͰ͘Ѫ͞Ε͍ͯΔɽ ߴ͍ΧελϚΠζੑͦͷಛͷ 1 ͭɽ ▶ Vim script ͱ͍͏ಈతܕ͚ݴޠ͕Έࠐ·Ε͍ͯΔ ˠઃఆϑΝΠϧϓϥάΠϯʹෳࡶͳॲཧΛهड़Մೳ ▶ Vim script νϡʔϦϯάશ ˠͦͦ vi ͷΩʔόΠϯυࣗମ͕νϡʔϦϯάશʁ ▶ “VimScript” “VimL” ͳͲਖ਼͘͠ͳ͍දه ˠͳ͔ͳ͔ “TeX” ͱॻ͍ͯΒ͑ͳ͍ TEX ͱࣅ͍ͯΔʁ 5 / 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ ΫΠοΫιʔτΛ࣮ͯ͠Έͨ TEX ࣮ Vim script ࣮ ιʔείʔυɿhttps://git.io/vPu97 6
/ 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ ϕϯνϚʔΫ ଌఆ݅ ▶ 10 ສཁૉ·ͰͷྻΛιʔτ͢Δͷʹ͔͔ͬͨ࣌ؒ ▶ ೖྗҎԼͷϫϯϥΠφʔͰ࡞ (n
= 3, 4, 5) $ ruby -e "puts Array(1..10**n).shuffle" ▶ ֤αΠζʹ͖ͭ 10 ճͣͭܭଌͨ͠ฏۉͱͯ͠ࢉग़ ▶ ٕज़తʹΑΓೖྗͷಡΈࠐΈؚ࣌ؒΉ ଌఆ݁Ռʢ୯Ґɿmsʣ ཁૉ C ݴޠ TEX ݴޠ Vim script 1,000 3.75 × 10−1 1.45 × 102 2.53 × 102 10,000 3.49 × 100 3.19 × 102 1.90 × 103 100,000 3.65 × 101 3.96 × 103 4.37 × 104 7 / 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ ײͳͲ ▶ ࣮ߦ͕ͱ͍ͯ ˠ C ݴޠ ≫ ʢӽ͑ΒΕͳ͍นʣ
≫ TEX ݴޠ ≥ Vim script ▶ ݴޠ༷͕ͱͯΞϨ ▶ TEX ݴޠɿϨδελͷ্ݶɼ੍ޚ௲ͷཏྻɼల։ͱධՁ ▶ Vim scriptɿه߸|"ͷڍಈɼίϚϯυͷཏྻɼ໊ؔ ˠͦΕͧΕྺ࢙తࣄ͕͋ΔͷͰɼ͋Δఔํͳ͍ ▶ Vim script ʢTEX ݴޠͱൺֱ͢ΔͱʣαΫοͱॻ͚Δ ▶ ϕϯνϚʔΫΛऔΔࡍͷγΣϧ͕ܳҰ൪ਏ͔ͬͨ ˠ Vim ͷىಈ࣌Φϓγϣϯଟ͗͢Ͱʂʁʢศར͚ͩͲʣ ࠷ޙʹͬͨͷʜʜ ָ͍͠ʋ (ɾ˲ɾ) ůʋ (ɾ˲ɾ) ůʋ (ɾ˲ɾ) ůͱ͍͏ؾ࣋ͪ 8 / 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ ຊʹ͓͚Δαϙʔτମ੍ TEX ίϛϡχςΟ ▶ TEX Forum ͕த৺ http://oku.edu.mie-u.ac.jp/tex
▶ Q&A ܗࣜ ▶ ࣭ͷํʹίπ͕ඞཁ ▶ TEX Ϣʔβͷू͍ 2016 11 ݄ 5 ˏभେֶ ▶ T େʹѪձ͕ଘࡏ Vim ίϛϡχςΟ ▶ Lingr ͷ Vim ෦͕த৺ http://lingr.com/room/vim ▶ ৗ࣌ٞ ▶ ࣭ͯ͠ྑ͍ͷ͔ ▶ VimConf 2016 11 ݄ 5 ˏϛΫγΟʢौ୩ʣ ▶ ༷ʑͳॴͰ {city}.vim ։࠵ ͍ͣΕ Twitter Ͱαϙʔτͯ͠Β͑Δ͜ͱ͕͋Δʂ 9 / 10
DSL ͰφϯσϞϓϩάϥϛϯάʂʁ ຊʹ DSL + φϯσϞϓϩάϥϛϯά = τϯσϞϓϩάϥϛϯά true
ਅͩΖ͏͔ʁ ▶ DSL ιϑτΣΞར༻ऀͷ͙ͦ͢ʹ͍Δଘࡏ ˠϑϩϯτΤϯυͷརΛଘʹ׆͔ͤΔ ▶ ͔ͤͬ͘ॻ͍ͨϓϩάϥϜɼ୭͔ʹͬͯΒ͍͍ͨ ˠχον͔ͩΒɼϥΠόϧগͳ͍ ▶ ϚΠφʔͰɼॿ͚ͯ͘ΕΔਓ͍Δ ˠ͕͍ؒΕɼಆ͍͚ͬͯΔ Բͤͣॻ͚ɼ͖ͬͱͤʹͳΕΔʂ 10 / 10