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
CSC509 Lecture 11
javiergs
PRO
0
180
受け取る人から提供する人になるということ
little_rubyist
0
250
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
Enabling DevOps and Team Topologies Through Architecture: Architecting for Fast Flow
cer
PRO
0
340
Creating a Free Video Ad Network on the Edge
mizoguchicoji
0
120
距離関数を極める! / SESSIONS 2024
gam0022
0
290
CSC509 Lecture 12
javiergs
PRO
0
160
役立つログに取り組もう
irof
28
9.6k
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
8
2.2k
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
930
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
3rd party scriptでもReactを使いたい! Preact + Reactのハイブリッド開発
righttouch
PRO
1
610
Featured
See All Featured
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
A designer walks into a library…
pauljervisheath
204
24k
Designing for Performance
lara
604
68k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
Designing Experiences People Love
moore
138
23k
Docker and Python
trallard
40
3.1k
Building an army of robots
kneath
302
43k
Optimizing for Happiness
mojombo
376
70k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
What's in a price? How to price your products and services
michaelherold
243
12k
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