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
9k
DSL でナンデモプログラミング!? / dsl-programming
TeX と Vim script を比較してみた
Watson
October 13, 2016
Tweet
Share
More Decks by Watson
See All by Watson
Building Dataset for Grounding of Formulae — Annotating Coreference Relations Among Math Identifiers / lrec2022
wtsnjp
0
150
MioGatto による数式グラウンディング データセットの構築 / nlp2022
wtsnjp
0
530
MioGatto: A Math Identifier-oriented Grounding Annotation Tool / mathui2021
wtsnjp
0
340
日本語化プロジェクト 〜TeX Live と learnlatex.org〜 / localize
wtsnjp
0
1.3k
Dataset Creation for Grounding of Formulae / SCIDOCA2020
wtsnjp
0
340
l3regex: TeX で実装された正規表現エンジン / l3regex
wtsnjp
1
810
A TeX-oriented Research Topic: Synthetic Analysis on Mathematical Expressions and Natural Language / tug2019
wtsnjp
0
190
Understanding Scientific Documents with Synthetic Analysis on Mathematical Expressions and Natural Language / cicm2019
wtsnjp
0
390
A Quantitative Evaluation of Natural Language Question Interpretation for Questions Answering Systems / jist2018
wtsnjp
0
330
Other Decks in Programming
See All in Programming
初めてDefinitelyTypedにPRを出した話
syumai
0
400
シェーダーで魅せるMapLibreの動的ラスタータイル
satoshi7190
1
480
What’s New in Compose Multiplatform - A Live Tour (droidcon London 2024)
zsmb
1
470
RubyLSPのマルチバイト文字対応
notfounds
0
120
CSC509 Lecture 11
javiergs
PRO
0
180
Ethereum_.pdf
nekomatu
0
460
現場で役立つモデリング 超入門
masuda220
PRO
15
3.2k
よくできたテンプレート言語として TypeScript + JSX を利用する試み / Using TypeScript + JSX outside of Web Frontend #TSKaigiKansai
izumin5210
6
1.7k
色々なIaCツールを実際に触って比較してみる
iriikeita
0
330
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
110
ふかぼれ!CSSセレクターモジュール / Fukabore! CSS Selectors Module
petamoriken
0
150
アジャイルを支えるテストアーキテクチャ設計/Test Architecting for Agile
goyoki
9
3.3k
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
27
4.3k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
The Cost Of JavaScript in 2023
addyosmani
45
6.7k
KATA
mclloyd
29
14k
Happy Clients
brianwarren
98
6.7k
Scaling GitHub
holman
458
140k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
The Cult of Friendly URLs
andyhume
78
6k
4 Signs Your Business is Dying
shpigford
180
21k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
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