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
How to Write Parser in PHP
Search
Jan Tvrdík
April 12, 2018
Programming
96
0
Share
How to Write Parser in PHP
Jan Tvrdík
April 12, 2018
More Decks by Jan Tvrdík
See All by Jan Tvrdík
Runtime Types in TypeScript
jantvrdik
0
57
Writing Readable Migrations with Nextras Migrations
jantvrdik
1
120
Nextras Mail Panel
jantvrdik
0
170
Writing reliable migrations with Nextras Migrations
jantvrdik
1
700
Other Decks in Programming
See All in Programming
Liberating Ruby's Parser from Lexer Hacks
ydah
2
2.7k
Agentic Elixir
whatyouhide
0
450
【ディップ|26年新卒研修資料】OpenAPI/Swagger REST API研修
dip_tech
PRO
0
160
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
350
PHPer、Cloudflare に引っ越す
suguruooki
2
200
Firefoxにコントリビューションして得られた学び
ken7253
2
160
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
380
エラー処理の温故知新 / history of error handling technic
ryotanakaya
7
1.9k
空間オーディオの活用
objectiveaudio
0
150
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
510
AWSはOSSをどのように 考えているのか?
akihisaikeda
0
120
AIを導入する前にやるべきこと
negima
2
350
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
sira's awesome portfolio website redesign presentation
elsirapls
0
240
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
1.3k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
Claude Code のすすめ
schroneko
67
220k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
320
The Invisible Side of Design
smashingmag
302
52k
Making Projects Easy
brettharned
120
6.6k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2k
A better future with KSS
kneath
240
18k
Faster Mobile Websites
deanohume
310
31k
Transcript
Jan Tvrdík
None
None
process of splitting text into words The square is blue
. The square is blue.
process of organizing sequence of words into structure The square
is blue .
The square is blue . D N V A NP
VP S
process of given meaning to the word structure
normally done by simple state machine fastest state machine in
PHP = PCRE
None
None
can be optimized to a single preg_* call by using
a smart trick David Grudl has taught me
None
ready to use lexer = nette/tokenizer
always start by writing a grammar EBNF simple not standardized
ABNF slightly less friendly than EBNF standardized by IETF PEG the coolest not standardized
multiple approaches possible easiest to start with is recursive descent
parser because it matches the grammar
JsonValue = JsonBool / JsonNull / JsonNumber / JsonString /
JsonArray / JsonObject JsonBool = TokenTrue / TokenFalse JsonNull = TokenNull
JsonNumber = TokenNumber JsonString = TokenString JsonArray = TokenSquareBracketOpen JsonArrayItems?
TokenSquareBracketClose JsonArrayItems = JsonValue (TokenComma JsonValue)* ...
None
Twitter + GitHub @JanTvrdik