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
Parsing for Humans
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yorick Peterse
May 20, 2014
Programming
120
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Parsing for Humans
Presentation for the Amsterdam Ruby user group.
Yorick Peterse
May 20, 2014
Transcript
25 slides
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?
More Decks by Yorick Peterse
See All by Yorick Peterse
Garbage Collection Crash Course
yorickpeterse
1
410
Making GitLab Faster
yorickpeterse
2
490
Rubinius & The Eternal Yak
yorickpeterse
1
290
Oga
yorickpeterse
3
220
Other Decks in Programming
See All in Programming
AIコーディングをセッションで終わらせない: PHPライブラリ開発におけるコンテキスト承継設計
ickx
0
110
Apache Airflow Introduction
leew
1
100
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
250
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
250
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
1.1k
エージェントの管理もエージェントに – herdr-core と自作バックログで作る司令塔 –
nearme_tech
PRO
2
180
Getting Started with Vibe Coding
miccheng
0
260
AI駆動TDD ― 2026年10月版
hrmstrsmgs
0
120
どうしても Eloquent でリポジトリパターンをやりたいんだ #phpcon_niigata / phpcon-niigata-2026
shogogg
0
710
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
290
Enforcing Your Architecture with Unit Tests in the AI Era (Swift Connection X)
steliosf
PRO
1
200
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
360
Featured
See All Featured
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.3k
Six Lessons from altMBA
skipperchong
29
4.6k
WCS-LA-2024
lcolladotor
0
1k
Odyssey Design
rkendrick25
PRO
3
980
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
2
540
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
400
Skip the Path - Find Your Career Trail
mkilby
1
310
How STYLIGHT went responsive
nonsquared
100
6.4k
Darren the Foodie - Storyboard
khoart
PRO
5
4.1k
Documentation Writing (for coders)
carmenintech
77
5.7k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
620
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
18k