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
88
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
360
Making GitLab Faster
yorickpeterse
2
450
Rubinius & The Eternal Yak
yorickpeterse
1
250
Oga
yorickpeterse
3
190
Other Decks in Programming
See All in Programming
AWSのLambdaで PHPを動かす選択肢
rinchoku
2
290
見えないメモリを観測する: PHP 8.4 `pg_result_memory_size()` とSQL結果のメモリ管理
kentaroutakeda
0
700
nekko cloudにおけるProxmox VE利用事例
irumaru
3
450
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
300
선언형 UI에서의 상태관리
l2hyunwoo
0
190
良いユニットテストを書こう
mototakatsu
8
3.1k
Amazon S3 NYJavaSIG 2024-12-12
sullis
0
110
「とりあえず動く」コードはよい、「読みやすい」コードはもっとよい / Code that 'just works' is good, but code that is 'readable' is even better.
mkmk884
3
680
Beyond ORM
77web
8
1.2k
useSyncExternalStoreを使いまくる
ssssota
6
1.4k
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
340
Kaigi on Railsに初参加したら、その日にLT登壇が決定した件について
tama50505
0
110
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
1
110
Scaling GitHub
holman
459
140k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
6
450
For a Future-Friendly Web
brad_frost
175
9.4k
Rails Girls Zürich Keynote
gr2m
94
13k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7k
Writing Fast Ruby
sferik
628
61k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
What's in a price? How to price your products and services
michaelherold
243
12k
It's Worth the Effort
3n
183
28k
GitHub's CSS Performance
jonrohan
1031
460k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
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?