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
Parsing for Humans
Search
Yorick Peterse
May 20, 2014
Programming
2
100
Parsing for Humans
Presentation for the Amsterdam Ruby user group.
Yorick Peterse
May 20, 2014
Tweet
Share
More Decks by Yorick Peterse
See All by Yorick Peterse
Garbage Collection Crash Course
yorickpeterse
1
390
Making GitLab Faster
yorickpeterse
2
470
Rubinius & The Eternal Yak
yorickpeterse
1
270
Oga
yorickpeterse
3
210
Other Decks in Programming
See All in Programming
例外処理を理解して、設計段階からエラーを見つけやすく、起こりにくく #phpconfuk
kajitack
12
6.4k
Flutterアプリ運用の現場で役立った監視Tips 5選
ostk0069
1
520
『実践MLOps』から学ぶ DevOps for ML
nsakki55
2
470
無秩序からの脱却 / Emergence from chaos
nrslib
1
8.4k
Evolving NEWT’s TypeScript Backend for the AI-Driven Era
xpromx
0
180
「文字列→日付」の落とし穴 〜Ruby Date.parseの意外な挙動〜
sg4k0
0
270
AI 時代だからこそ抑えたい「価値のある」PHP ユニットテストを書く技術 #phpconfuk / phpcon-fukuoka-2025
shogogg
1
580
モデル駆動設計をやってみよう Modeling Forum2025ワークショップ/Let’s Try Model-Driven Design
haru860
0
180
知られているようで知られていない JavaScriptの仕様 4選
syumai
0
630
Private APIの呼び出し方
kishikawakatsumi
3
900
Stay Hacker 〜九州で生まれ、Perlに出会い、コミュニティで育つ〜
pyama86
2
2.5k
Micro Frontendsで築いた 共通基盤と運用の試行錯誤 / Building a Shared Platform with Micro Frontends: Operational Learnings
kyntk
0
130
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
4.9k
How to Think Like a Performance Engineer
csswizardry
28
2.3k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Leading Effective Engineering Teams in the AI Era
addyosmani
8
1.1k
A designer walks into a library…
pauljervisheath
210
24k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
3.8k
Building Adaptive Systems
keathley
44
2.8k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
340
The Pragmatic Product Professional
lauravandoore
36
7k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.7k
Rebuilding a faster, lazier Slack
samanthasiow
84
9.3k
Transcript
Parsing For Humans
@yorickpeterse (Github, Twitter, Gmail, etc)
Olery http://olery.com/
Parsing “Analysing a string of symbols according to the rules
of a grammar.”
10 + 10
number = [0-9]+ operator = “+”
Vocabulary Token, AST, Lexer & Parser
Token A label for a specific part of the input.
10 [:INTEGER, “10”]
Abstract Syntax Tree A tree structure representing the input.
Markdown Lists * Item * Nested item
(unordered-list (list “Item” (unordered-list (list “Nested item”))))
Lexer Takes raw input and returns a sequence of tokens.
Parser Takes tokens as input and returns an AST.
Available Tools
ANTLR, Bison, Coco/R, Flex, Happy, Lemon, jQuery, Parslet, Racc, Ragel,
Rexical, Treetop, Yacc
Ragel & Racc
Ragel “A finite state machine compiler.”
“<!--” any* “-->” => { … };
$ ragel -R lexer.rl -o lexer.rb
Racc “A LALR(1) parser generator.”
expression : NUMBER OPERATOR NUMBER { … } ;
$ racc -o parser.rb parser.y
Oga Parsing XML/HTML in Ruby https://github.com/yorickpeterse/oga
Questions?