Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
0
95
How to Write Parser in PHP
Jan Tvrdík
April 12, 2018
Tweet
Share
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
110
Nextras Mail Panel
jantvrdik
0
170
Writing reliable migrations with Nextras Migrations
jantvrdik
1
700
Other Decks in Programming
See All in Programming
AIコーディングエージェント(skywork)
kondai24
0
180
Github Copilotのチャット履歴ビューワーを作りました~WPF、dotnet10もあるよ~ #clrh111
katsuyuzu
0
110
マスタデータ問題、マイクロサービスでどう解くか
kts
0
110
LLMで複雑な検索条件アセットから脱却する!! 生成的検索インタフェースの設計論
po3rin
3
830
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
510
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
220
これだけで丸わかり!LangChain v1.0 アップデートまとめ
os1ma
6
1.9k
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
130
AIコーディングエージェント(NotebookLM)
kondai24
0
200
AIエージェントの設計で注意するべきポイント6選
har1101
1
170
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
270
これならできる!個人開発のすゝめ
tinykitten
PRO
0
110
Featured
See All Featured
Navigating Team Friction
lara
191
16k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
9
1k
Visualization
eitanlees
150
16k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
[SF Ruby Conf 2025] Rails X
palkan
0
540
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
359
30k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Designing Experiences People Love
moore
143
24k
Designing for Performance
lara
610
69k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
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