$30 off During Our Annual Pro Sale. View Details »
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
Python札幌 LT資料
t3tra
4
840
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
130
Go コードベースの構成と AI コンテキスト定義
andpad
0
130
LLM Çağında Backend Olmak: 10 Milyon Prompt'u Milisaniyede Sorgulamak
selcukusta
0
130
マスタデータ問題、マイクロサービスでどう解くか
kts
0
110
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
370
非同期処理の迷宮を抜ける: 初学者がつまづく構造的な原因
pd1xx
1
730
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
220
認証・認可の基本を学ぼう後編
kouyuume
0
240
20251127_ぼっちのための懇親会対策会議
kokamoto01_metaps
2
450
AIコーディングエージェント(NotebookLM)
kondai24
0
210
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
120
Featured
See All Featured
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.3k
Mobile First: as difficult as doing things right
swwweet
225
10k
Ruling the World: When Life Gets Gamed
codingconduct
0
92
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
670
Information Architects: The Missing Link in Design Systems
soysaucechin
0
700
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
980
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.4k
Getting science done with accelerated Python computing platforms
jacobtomlinson
0
71
The Language of Interfaces
destraynor
162
25k
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