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
110
Nextras Mail Panel
jantvrdik
0
170
Writing reliable migrations with Nextras Migrations
jantvrdik
1
700
Other Decks in Programming
See All in Programming
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
0
990
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
820
GISエンジニアから見たLINKSデータ
nokonoko1203
0
190
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
170
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
260
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
170
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
260
Patterns of Patterns
denyspoltorak
0
1.3k
Implementation Patterns
denyspoltorak
0
270
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
360
AgentCoreとHuman in the Loop
har1101
5
200
CSC307 Lecture 07
javiergs
PRO
0
520
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
75
We Analyzed 250 Million AI Search Results: Here's What I Found
joshbly
1
570
Building a Scalable Design System with Sketch
lauravandoore
463
34k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
110
The browser strikes back
jonoalderson
0
340
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
260
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Documentation Writing (for coders)
carmenintech
77
5.2k
Building Adaptive Systems
keathley
44
2.9k
Between Models and Reality
mayunak
1
170
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.4k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
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