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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
56
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
AI活用のコスパを最大化する方法
ochtum
0
380
2026-03-27 #terminalnight 変数展開とコマンド展開でターミナル作業をスマートにする方法
masasuzu
0
310
Don't Prompt Harder, Structure Better
kitasuke
0
620
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
270
へんな働き方
yusukebe
6
2.9k
Feature Toggle は捨てやすく使おう
gennei
0
450
煩雑なSkills管理をSoC(関心の分離)により解決する――関心を分離し、プロンプトを部品として育てるためのOSSを作った話 / Solving Complex Skills Management Through SoC (Separation of Concerns)
nrslib
3
760
飯MCP
yusukebe
0
490
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
2
150
Running Swift without an OS
kishikawakatsumi
0
670
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
250
我々はなぜ「層」を分けるのか〜「関心の分離」と「抽象化」で手に入れる変更に強いシンプルな設計〜 #phperkaigi / PHPerKaigi 2026
shogogg
2
840
Featured
See All Featured
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
430
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.3k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
480
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
370
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Accessibility Awareness
sabderemane
0
94
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
680
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
30 Presentation Tips
portentint
PRO
1
270
Ruling the World: When Life Gets Gamed
codingconduct
0
190
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