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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
500
outputting-beautiful-s-expression
niyarin
0
430
Serialisp
niyarin
1
740
Mongo DBとS式検索
niyarin
0
360
goodbye-python-repl
niyarin
0
400
SchemeのEphemeronとWeak Pairの説明
niyarin
0
1.1k
red-paren-scheme-rev-macro.pdf
niyarin
0
460
Other Decks in Programming
See All in Programming
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
1.9k
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
340
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
420
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
330
iOSDC2026登壇資料.pdf
riofujimon
0
160
From 6 People Classroom Meetup to 100 People Regional Conference / FOSS4G Hiroshima 2026
furukawayasuto
0
200
変化を抱擁するドキュメントの作り方 - ビジネスルール駆動開発がもたらす、コードとの新しい関係
ioki
2
200
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
110
自分的「カンファレンスの楽しみ方」
syumai
0
200
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
170
速習iPhone Duo対応
yuukiw00w
1
510
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
230
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Designing Experiences People Love
moore
143
24k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
890
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
500
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
65k
Git: the NoSQL Database
bkeepers
PRO
432
67k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
700
Utilizing Notion as your number one productivity tool
mfonobong
4
590
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文字先読み