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
Dynamic Grammars
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Lukas Renggli
October 04, 2011
Technology
64
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Dynamic Grammars
Lukas Renggli
October 04, 2011
More Decks by Lukas Renggli
See All by Lukas Renggli
Domain-Specific Program Checking
renggli
1
42
Natural Language Checking with Program Checking Tools
renggli
1
63
The Dynamic Language is not Enough
renggli
1
61
Dynamic Language Embedding With Homogeneous Tool Support
renggli
1
130
Other Decks in Technology
See All in Technology
AI時代の組織作り:チーム開発から「個人×AI」への移行と、持続可能な「開発資本」の築き方
ham0215
2
810
[dbts2026]数十PBの超巨大データ×AI活用を支えるSnowflakeの実力〜大規模環境におけるアーキテクチャと運用のリアル〜
y_matsubara
0
130
長い仕事を任せる (Workflows、クラウドセッション、Kiro Web) | 目指せ Kiro マスター 10
inariku
PRO
3
170
An Introduction to Context Ontology Accelerator (teaching AI agents what your data means)
inariku
PRO
1
200
Kiro アップデート 2026 年 11 月号 (11 月 8 日時点) | 目指せ Kiro マスター アップデート編
inariku
PRO
2
100
LLM 基盤と kagent v0 を全部 k8s に入れてみた / Deploy both LLM and kagent v0 in k8s
kota2and3kan
0
120
分析作業をどこまで任せるか自分で決められる AIネイティブBI『Golden Analytics』が 良さげな話 /golden-analytics-is-ai-native-bi
shinyaa31
0
140
【Oracle AI SPOTLIGHT ウェビナー】【特別開催:日本語で解説!】Oracle AI World 2026 最新情報フィードバック
oracle4engineer
PRO
1
130
コードレビューをなくして見えたもの
henteko
0
150
Active Directory と Entra ID のむむむな関係
murachiakira
PRO
4
1.8k
bpf_arenaとstruct_opsを使うのが難しかった話
masu_mi
0
230
ゼロから作るWebアプリの新定番!?Amplify Gen 2 × AWS Blocksで実現する「開発速度とRDBの柔軟性のいいとこ取り」
amixedcolor
1
230
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Designing for humans not robots
tammielis
254
26k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
240
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
6
910
The Pragmatic Product Professional
lauravandoore
37
7.5k
Utilizing Notion as your number one productivity tool
mfonobong
4
640
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
280
Leading Effective Engineering Teams in the AI Era
addyosmani
9
2.9k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380
Git: the NoSQL Database
bkeepers
PRO
433
67k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.5k
Transcript
Dynamic Grammars Lukas Renggli, Stéphane Ducasse, Tudor Gîrba, Oscar Nierstrasz
[Adapted from The New Oxford American Dictionary on Grammar] grammar
a set of rules governing what strings are valid or allowable in a [formal] language.
dynamic grammar a high-level grammar that executes at runtime behaviors
that other grammars perform during compilation, see dynamic languages. [Adapted from Wikipedia on Dynamic Programming Languages]
Dynamic Grammars Dynamic Languages ‣ Late-bound behavior ‣ First-class representation
‣ On-the-fly transformation ‣ Introspection and reflection
Why would we want that?
Language Boxes Host Environment Language and Tool Extensions
Language Boxes Host Environment Dynamic Grammars Language and Tool Extensions
Language Change Language Concern Language Scope Language Box * *
* *
Language Change = Host Language Grammar δ
Language Change = Grammar Transformation
scanIdentifier self step. ((currentCharacter between: $A and: $Z) or: [
currentCharacter between: $a and: $z ]) ifTrue: [ [ self recordMatch: #IDENTIFIER. self step. (currentCharacter between: $0 and: $9) or: [ (currentCharacter between: $A and: $Z) or: [ currentCharacter between: $a and: $z ] ] ] whileTrue. ^ self reportLastMatch ]
scanIdentifier self step. ((currentCharacter between: $A and: $Z) or: [
currentCharacter between: $a and: $z ]) ifTrue: [ [ self recordMatch: #IDENTIFIER. self step. (currentCharacter between: $0 and: $9) or: [ (currentCharacter between: $A and: $Z) or: [ currentCharacter between: $a and: $z ] ] ] whileTrue. ^ self reportLastMatch ] ✖
#( #[1 0 9 0 25 0 13 0 34
0 17 0 40 0 21 0 41] #[1 0 9 0 25 0 13 0 34 0 93 0 76 0 157 0 112] #[1 2 38 0 21 2 38 0 25 2 38 0 26 0 13 0 34] #[0 1 154 0 16 0 21 0 25 0 26 0 34 0 40 0 41] #[0 1 210 0 76 0 81] #[0 1 214 0 76 0 81] #[1 0 173 0 76 0 177 0 81] #[0 1 134 0 16 0 21 0 25 0 26 0 34 0 40 0 41] #[1 1 46 0 21 1 46 0 25 1 46 0 26 1 69] #[1 1 54 0 21 1 54 0 25 1 54 0 26 1 54 0 34] #[0 2 102 0 21 0 25 0 26 0 34 0 40 0 41 0 76] #[0 2 50 0 21 0 25 0 26 0 76 0 79] #[1 1 13 0 76 2 85 0 124 1 21 0 125] #[1 2 89 0 17 2 30 0 21 2 30 0 82] #[1 2 93 0 21 2 97 0 82] )
#( #[1 0 9 0 25 0 13 0 34
0 17 0 40 0 21 0 41] #[1 0 9 0 25 0 13 0 34 0 93 0 76 0 157 0 112] #[1 2 38 0 21 2 38 0 25 2 38 0 26 0 13 0 34] #[0 1 154 0 16 0 21 0 25 0 26 0 34 0 40 0 41] #[0 1 210 0 76 0 81] #[0 1 214 0 76 0 81] #[1 0 173 0 76 0 177 0 81] #[0 1 134 0 16 0 21 0 25 0 26 0 34 0 40 0 41] #[1 1 46 0 21 1 46 0 25 1 46 0 26 1 69] #[1 1 54 0 21 1 54 0 25 1 54 0 26 1 54 0 34] #[0 2 102 0 21 0 25 0 26 0 34 0 40 0 41 0 76] #[0 2 50 0 21 0 25 0 26 0 76 0 79] #[1 1 13 0 76 2 85 0 124 1 21 0 125] #[1 2 89 0 17 2 30 0 21 2 30 0 82] #[1 2 93 0 21 2 97 0 82] ) ✖
None
a..z a..z 0..9 ID ::= letter { letter | digit
} ;
letter letter digit sequence choice star id := #letter ,
(#letter / #digit) star
letter letter digit sequence choice star id := #letter asParser
, (#letter asParser / #digit asParser) star
Scannerless Parser
Parsing Expression Grammar
Packrat Parser
Parser Combinator
None
Grammar Transformation
Graph Rewriting
letter letter digit sequence choice star #letter → #letter /
$_
letter digit sequence choice star choice _ letter choice _
#letter → #letter / $_
Optimizations
letter digit sequence choice star choice _ letter choice _
(`a / `b) / `c → `a / `b / `c
letter digit sequence choice star choice _ letter _ (`a
/ `b) / `c → `a / `b / `c
letter digit sequence choice star choice _ letter _ in
general a graph (`a / `b) / `c → `a / `b / `c
Conflicts?
SELECT * FROM users
SELECT * FROM users | r | r := ^
User fromRow: r .
expr sql |
SELECT * FROM users <SQL: >
expr sql / ordered
No Conflicts
No Ambiguities
expr sql / surprise
/ expr sql surprise
expr sql | !expr sql / !sql expr
expr sql $ !expr sql / !sql expr / ui