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
140
MioGatto による数式グラウンディング データセットの構築 / nlp2022
wtsnjp
0
520
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
800
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
レガシーな Android アプリのリアーキテクチャ戦略
oidy
1
170
[PyCon Korea 2024 Keynote] 커뮤니티와 파이썬, 그리고 우리
beomi
0
110
Universal Linksの実装方法と陥りがちな罠
kaitokudou
1
220
2万ページのSSG運用における工夫と注意点 / Vue Fes Japan 2024
chinen
3
1.3k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
390
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
150
PagerDuty を軸にした On-Call 構築と運用課題の解決 / PagerDuty Japan Community Meetup 4
horimislime
1
110
役立つログに取り組もう
irof
26
8.7k
約9000個の自動テストの 時間を50分->10分に短縮 Flakyテストを1%以下に抑えた話
hatsu38
23
11k
Nuxtベースの「WXT」でChrome拡張を作成する | Vue Fes 2024 ランチセッション
moshi1121
1
520
Server Driven Compose With Firebase
skydoves
0
400
Piniaの現状と今後
waka292
5
1.5k
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
510
110k
Building Your Own Lightsaber
phodgson
102
6k
How To Stay Up To Date on Web Technology
chriscoyier
788
250k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2.1k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Building an army of robots
kneath
302
42k
A designer walks into a library…
pauljervisheath
202
24k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
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