Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
How to Write Parser in PHP
Search
Jan Tvrdík
April 12, 2018
Programming
110
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How to Write Parser in PHP
Jan Tvrdík
April 12, 2018
Transcript
19 slides
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
More Decks by Jan Tvrdík
See All by Jan Tvrdík
Runtime Types in TypeScript
jantvrdik
0
93
Writing Readable Migrations with Nextras Migrations
jantvrdik
1
120
Nextras Mail Panel
jantvrdik
0
180
Writing reliable migrations with Nextras Migrations
jantvrdik
1
720
Other Decks in Programming
See All in Programming
Crash Auto Pipelines
veronikapj
1
450
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
How SRE Grew Out of Server-Side Work and Became the Team's Own / サーバサイドから始まったSREを チームに渡すまで
maaaato
1
360
止まらない比較を止める — 余帰納法で無限ストリームを比べる
tarao
0
220
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
270
AWS CDKを理解するために公式の定義を深掘って解説してみる / Understanding AWS CDK by Digging into Its Official Definition
akihisaikeda
3
350
Rails初心者がパスキーを実装してみて大変だったこと
ktombow
0
240
Stage 3でも仕様は変わる。アプリケーション開発者のためのTC39プロセスの読み方
bicstone
1
930
疎結合とは何か?ソフトウェア設計における結合バランスについて考える #phpcon_niigata
kajitack
2
430
protojson における文字化けの扱い
kazuki1023
0
470
コード生成時代のAPI定義を支えるRequest Spec移行
pvcresin
0
310
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
440
Featured
See All Featured
エンジニアに許された特別な時間の終わり
watany
109
250k
Optimising Largest Contentful Paint
csswizardry
37
4k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.3k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
610
Un-Boring Meetings
codingconduct
0
510
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.2k
Design in an AI World
tapps
1
400
Marketing to machines
jonoalderson
1
6k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
480