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
Gorgos-parser-combinator-written-in-scheme
Search
Niyarin
November 26, 2020
Programming
430
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Gorgos-parser-combinator-written-in-scheme
Schemeでパーサコンビネータを作りました
Niyarin
November 26, 2020
More Decks by Niyarin
See All by Niyarin
Scheme用nREPLの開発(エラー出力の改善)
niyarin
0
190
bel lispの紹介
niyarin
0
800
nanopass-compiler-frameworkを使ってみました
niyarin
0
510
outputting-beautiful-s-expression
niyarin
0
430
Serialisp
niyarin
1
750
Mongo DBとS式検索
niyarin
0
360
goodbye-python-repl
niyarin
0
410
SchemeのEphemeronとWeak Pairの説明
niyarin
0
1.1k
red-paren-scheme-rev-macro.pdf
niyarin
0
470
Other Decks in Programming
See All in Programming
AI-Powered Domain-Driven Design
ziobrando
0
370
PyConTW 2026 - AI Coding 不只是工具升級, 區域醫院醫療資訊系統協作開發與資訊團隊轉型實踐
cclai999
0
220
[2026-10-09]一枚の布で作らなくてもいい。 信頼性は「パッチワーク」で紡がれる~既存の運用と新しい可能性をつなぎ合わせてきたCREの話~
tosite
0
130
Next.js: The final boss of Web Performance
guaca
0
370
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
500
Materialが消えた日 〜真っ白なFlutterキャンバスにRenderObjectで絵を描く〜
umigishiaoi
0
130
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.3k
Kotlinの15年とServer-Side Kotlin
n_takehata
1
190
Snowflake Openflow Connector利用の勘所 / 20261024developersio2026tokyo-snowflake-openflow
kasacchiful
PRO
0
260
Getting Started with Vibe Coding
miccheng
0
140
Inertia Rails: The One-Person Framework with React & Friends
skryukov
0
200
Event is what happens
moro
2
2.6k
Featured
See All Featured
Writing Fast Ruby
sferik
630
63k
Become a Pro
speakerdeck
PRO
31
6.3k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
1
360
GraphQLとの向き合い方2022年版
quramy
50
15k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
550
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
1.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Paper Plane
katiecoart
PRO
5
54k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.9k
Navigating Team Friction
lara
192
16k
Heart Work Chapter 1 - Part 1
lfama
PRO
10
37k
Transcript
Parser combinator (written in Scheme) 「Gorgos」 Niyarin
Schemeでparser combinator を作った ・私はパーサに関しては素人です ・文字列を入れるとSchemeオブジェクトを返す手続きを作成する (Scheme手続きを組み合わせて)
返り値は多値 ・”受理したもの”と、”のこりの文字列”が返る ・文字aのパーサに”abcdef”を入れると、 受理した#\aと残りの”bcdef”が返る
“ab”を受け取るパーサ1 ・”gchar”を2回使って実装する
“ab”を受け取るパーサ2 ・よく使いそうなものは楽できるような部品が提供されている 特定の文字列を受け取るパーサ “gstring”
リストを意識したパーサコンビネータ1 ・gorgosはリストを返すことを意識した作りになっている ・受理→ 変換の”変換”を簡潔に書くため リストリーダの例
リストを意識したパーサコンビネータ2 ・なるべく変換を手抜きしたいので、gpairというpairを返すも のも作った ab…. を受け取る例
Schemeにcharsetがあって楽できた ・Schemeには文字の集合というデータ構造がある (SRFI 14) or (scheme charset) ・charsetに含まれているかどうかの部分だけでよかった ・組み込みも充実している char-set:upper-case
char-set:digit char-set:whitespace など
macro/手続きでありがちなやつ ・glistは最初は手続きだった → piyo-parserがfoo-parserの前に来ていないとだめ (右)再帰する場合もlambdaで囲わないと再帰できない ・parserを受け取るものをすべてマクロに書き換えた ・applyとかに渡すことができなくなったので、glist-fという関数版も用意 した
未完成な部分 ・文字列→ Scheme objectはできている ・今作り込んでいる部分 1.エラー表示 2.1文字先読みだけでいけるように変換orチェックする対応 port (fileストリームなど)から使えるようにしたい 1文字先読み