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
81
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
24
Writing Readable Migrations with Nextras Migrations
jantvrdik
1
99
Nextras Mail Panel
jantvrdik
0
140
Writing reliable migrations with Nextras Migrations
jantvrdik
1
640
Other Decks in Programming
See All in Programming
Migrating to Signals: A Practical Workshop
manfredsteyer
PRO
0
280
ここ1~2年くらいで 使えるようになった(主要ブラウザーの最新版 がすべて対応した ) ウェブの新機能について ランダムに喋る!
myzkyy
9
6.4k
Learning PHP and Static Analysis with PHP Parser
inouehi
1
250
Docker ハンズオン / docker-hands-on
suzukihoge
51
16k
Some Quick Ideas To Improve Your Tests ( #jassttokyo )
teyamagu
PRO
2
2.3k
Understanding Ast By Looking
inouehi
0
120
孤独のCTOグルメという やや奇抜な企画をやった目的と効果
shoheimitani
3
1k
TCAの Shared Stateって どういう仕組みになってんの?
yimajo
0
330
OpenAPI を守るのは難しい
ohmori_yusuke
1
140
フロントエンドパフォーマンス 入門
shouta2
7
1.5k
TCA魔法学入門🪄
dazy
0
280
オブジェクト指向コードレビューの新しいアプローチ
akkie76
3
1.1k
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
14
1.3k
BBQ
matthewcrist
78
8.7k
Embracing the Ebb and Flow
colly
78
4.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
8
8.2k
The Invisible Side of Design
smashingmag
293
49k
The World Runs on Bad Software
bkeepers
PRO
60
6.6k
VelocityConf: Rendering Performance Case Studies
addyosmani
319
23k
Making the Leap to Tech Lead
cromwellryan
122
8.4k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
A designer walks into a library…
pauljervisheath
199
23k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
185
15k
The Language of Interfaces
destraynor
150
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