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
0
94
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
55
Writing Readable Migrations with Nextras Migrations
jantvrdik
1
110
Nextras Mail Panel
jantvrdik
0
160
Writing reliable migrations with Nextras Migrations
jantvrdik
1
690
Other Decks in Programming
See All in Programming
Claude CodeによるAI駆動開発の実践 〜そこから見えてきたこれからのプログラミング〜
iriikeita
0
300
はじめてのDSPy - 言語モデルを『プロンプト』ではなく『プログラミング』するための仕組み
masahiro_nishimi
3
670
One Enishi After Another
snoozer05
PRO
0
130
Devvox Belgium - Agentic AI Patterns
kdubois
1
130
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
600
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
290
Catch Up: Go Style Guide Update
andpad
0
230
3年ぶりにコードを書いた元CTOが Claude Codeと30分でMVPを作った話
maikokojima
0
570
kiroとCodexで最高のSpec駆動開発を!!数時間で web3ネイティブなミニゲームを作ってみたよ!
mashharuki
0
720
What's new in Spring Modulith?
olivergierke
1
160
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
230
釣り地図SNSにおける有料機能の実装
nokonoko1203
0
170
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
A Modern Web Designer's Workflow
chriscoyier
697
190k
Leading Effective Engineering Teams in the AI Era
addyosmani
7
490
Git: the NoSQL Database
bkeepers
PRO
431
66k
Reflections from 52 weeks, 52 projects
jeffersonlam
353
21k
Producing Creativity
orderedlist
PRO
347
40k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
127
54k
Practical Orchestrator
shlominoach
190
11k
Visualization
eitanlees
149
16k
Building Adaptive Systems
keathley
44
2.8k
GitHub's CSS Performance
jonrohan
1032
470k
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