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
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
120
Nextras Mail Panel
jantvrdik
0
170
Writing reliable migrations with Nextras Migrations
jantvrdik
1
700
Other Decks in Programming
See All in Programming
ふつうの Rubyist、ちいさなデバイス、大きな一年
bash0c7
0
990
How to stabilize UI tests using XCTest
akkeylab
0
130
Codex の「自走力」を高める
yorifuji
0
1.2k
Codexに役割を持たせる 他のAIエージェントと組み合わせる実務Tips
o8n
4
1.3k
コードレビューをしない選択 #でぃーぷらすトウキョウ
kajitack
3
990
Windows on Ryzen and I
seosoft
0
300
AI活用のコスパを最大化する方法
ochtum
0
110
どんと来い、データベース信頼性エンジニアリング / Introduction to DBRE
nnaka2992
1
300
Angular-Apps smarter machen mit Gen AI: Lokal und offlinefähig - Hands-on Workshop!
christianliebel
PRO
0
120
オブザーバビリティ駆動開発って実際どうなの?
yohfee
4
870
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
570
nuget-server - あなたが必要だったNuGetサーバー
kekyo
PRO
0
270
Featured
See All Featured
Optimizing for Happiness
mojombo
378
71k
Bash Introduction
62gerente
615
210k
Deep Space Network (abreviated)
tonyrice
0
92
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.5k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
140
For a Future-Friendly Web
brad_frost
183
10k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
410
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
Building an army of robots
kneath
306
46k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.5k
sira's awesome portfolio website redesign presentation
elsirapls
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