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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
CSC307 Lecture 02
javiergs
PRO
1
780
MUSUBIXとは
nahisaho
0
130
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
170
AIによるイベントストーミング図からのコード生成 / AI-powered code generation from Event Storming diagrams
nrslib
2
1.9k
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6.1k
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
130
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
730
Data-Centric Kaggle
isax1015
2
770
CSC307 Lecture 01
javiergs
PRO
0
690
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
2.5k
Fragmented Architectures
denyspoltorak
0
150
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
210
Featured
See All Featured
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
64
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Design in an AI World
tapps
0
140
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.7k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Bash Introduction
62gerente
615
210k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
0
320
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
140
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
710
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
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