SlideShare una empresa de Scribd logo
1 de 43
Descargar para leer sin conexión
Dynamic Grammars
 Lukas Renggli, Stéphane Ducasse,
   Tudor Gîrba, Oscar Nierstrasz
grammar
a set of rules governing what
  strings are valid or allowable
  in a [formal] language.




                    [Adapted from The New Oxford American Dictionary on Grammar]
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 and Tool Extensions


Language Boxes




Host Environment
Language and Tool Extensions


Language Boxes




                               Grammars
                               Dynamic
Host Environment
Language
               *
                    Change


Language       *   Language
  Box               Concern
           *

               *   Language
                    Scope
Language
 Change
           =
               δ   Host Language
                     Grammar
Language          Grammar
           =
 Change        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] )
ID ::= letter { letter | digit } ;




    a..z             a..z
                     0..9
id := #letter , (#letter / #digit) star



            sequence

       letter         star

                     choice

                 letter      digit
id := #letter asParser ,
(#letter asParser / #digit asParser) star


               sequence

          letter        star

                       choice

                   letter      digit
Scannerless Parser
Parsing Expression
     Grammar
Packrat Parser
Parser Combinator
Grammar
Transformation
Graph
Rewriting
#letter → #letter / $_



     sequence

letter        star

             choice

         letter      digit
#letter → #letter / $_



         sequence

  choice            star

letter     _      choice

           choice          digit

         letter   _
Optimizations
(`a / `b) / `c → `a / `b / `c



          sequence

   choice            star

 letter     _      choice

            choice          digit

          letter   _
(`a / `b) / `c → `a / `b / `c



          sequence

   choice           star

 letter    _       choice

          letter   _       digit
(`a / `b) / `c → `a / `b / `c



in general             sequence
 a graph
                choice           star

              letter    _       choice

                       letter   _       digit
Conflicts?
SELECT * FROM users
|r|
r := SELECT * FROM users .
^ User fromRow: r
expr | sql
<SQL: SELECT * FROM users>
ordered



expr / sql
No Conflicts
No Ambiguities
surprise



expr / sql
surprise



sql / expr
!expr sql / !sql expr



expr | sql
!expr sql / !sql expr / ui



expr $ sql

Más contenido relacionado

La actualidad más candente

La actualidad más candente (12)

04 1 변수와 자료형
04 1 변수와 자료형04 1 변수와 자료형
04 1 변수와 자료형
 
Business Rules with Brick
Business Rules with BrickBusiness Rules with Brick
Business Rules with Brick
 
Php
PhpPhp
Php
 
Sigma type
Sigma typeSigma type
Sigma type
 
RubyConf Portugal 2014 - Why ruby must go!
RubyConf Portugal 2014 - Why ruby must go!RubyConf Portugal 2014 - Why ruby must go!
RubyConf Portugal 2014 - Why ruby must go!
 
What's New in Perl? v5.10 - v5.16
What's New in Perl?  v5.10 - v5.16What's New in Perl?  v5.10 - v5.16
What's New in Perl? v5.10 - v5.16
 
Ruby Classes
Ruby ClassesRuby Classes
Ruby Classes
 
From android/java to swift (1)
From android/java to swift (1)From android/java to swift (1)
From android/java to swift (1)
 
Php Chapter 1 Training
Php Chapter 1 TrainingPhp Chapter 1 Training
Php Chapter 1 Training
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)
 
Lists and arrays
Lists and arraysLists and arrays
Lists and arrays
 
Mysqlppt
MysqlpptMysqlppt
Mysqlppt
 

Similar a Dynamic grammars

Helvetia
HelvetiaHelvetia
HelvetiaESUG
 
The Dynamic Language is not Enough
The Dynamic Language is not EnoughThe Dynamic Language is not Enough
The Dynamic Language is not EnoughLukas Renggli
 
perl course-in-mumbai
 perl course-in-mumbai perl course-in-mumbai
perl course-in-mumbaivibrantuser
 
perl course-in-mumbai
perl course-in-mumbaiperl course-in-mumbai
perl course-in-mumbaivibrantuser
 
2016 bioinformatics i_python_part_3_io_and_strings_wim_vancriekinge
2016 bioinformatics i_python_part_3_io_and_strings_wim_vancriekinge2016 bioinformatics i_python_part_3_io_and_strings_wim_vancriekinge
2016 bioinformatics i_python_part_3_io_and_strings_wim_vancriekingeProf. Wim Van Criekinge
 
Using Regular Expressions and Staying Sane
Using Regular Expressions and Staying SaneUsing Regular Expressions and Staying Sane
Using Regular Expressions and Staying SaneCarl Brown
 
ANSI C REFERENCE CARD
ANSI C REFERENCE CARDANSI C REFERENCE CARD
ANSI C REFERENCE CARDTia Ricci
 
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangAchieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangSean Cribbs
 
Ggplot2 work
Ggplot2 workGgplot2 work
Ggplot2 workARUN DN
 
T03 b basicioscanf
T03 b basicioscanfT03 b basicioscanf
T03 b basicioscanfteach4uin
 
Functional Error Handling with Cats
Functional Error Handling with CatsFunctional Error Handling with Cats
Functional Error Handling with CatsMark Canlas
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Aslak Hellesøy
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Aslak Hellesøy
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Aslak Hellesøy
 
Regular Expressions: JavaScript And Beyond
Regular Expressions: JavaScript And BeyondRegular Expressions: JavaScript And Beyond
Regular Expressions: JavaScript And BeyondMax Shirshin
 
Regexp secrets
Regexp secretsRegexp secrets
Regexp secretsHiro Asari
 

Similar a Dynamic grammars (20)

Helvetia
HelvetiaHelvetia
Helvetia
 
The Dynamic Language is not Enough
The Dynamic Language is not EnoughThe Dynamic Language is not Enough
The Dynamic Language is not Enough
 
Regular expression for everyone
Regular expression for everyoneRegular expression for everyone
Regular expression for everyone
 
php string part 4
php string part 4php string part 4
php string part 4
 
perl course-in-mumbai
 perl course-in-mumbai perl course-in-mumbai
perl course-in-mumbai
 
perl course-in-mumbai
perl course-in-mumbaiperl course-in-mumbai
perl course-in-mumbai
 
2016 bioinformatics i_python_part_3_io_and_strings_wim_vancriekinge
2016 bioinformatics i_python_part_3_io_and_strings_wim_vancriekinge2016 bioinformatics i_python_part_3_io_and_strings_wim_vancriekinge
2016 bioinformatics i_python_part_3_io_and_strings_wim_vancriekinge
 
Using Regular Expressions and Staying Sane
Using Regular Expressions and Staying SaneUsing Regular Expressions and Staying Sane
Using Regular Expressions and Staying Sane
 
ANSI C REFERENCE CARD
ANSI C REFERENCE CARDANSI C REFERENCE CARD
ANSI C REFERENCE CARD
 
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangAchieving Parsing Sanity In Erlang
Achieving Parsing Sanity In Erlang
 
Ggplot2 work
Ggplot2 workGgplot2 work
Ggplot2 work
 
T03 b basicioscanf
T03 b basicioscanfT03 b basicioscanf
T03 b basicioscanf
 
Php functions
Php functionsPhp functions
Php functions
 
Functional Error Handling with Cats
Functional Error Handling with CatsFunctional Error Handling with Cats
Functional Error Handling with Cats
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009Ruby presentasjon på NTNU 22 april 2009
Ruby presentasjon på NTNU 22 april 2009
 
Regular Expressions: JavaScript And Beyond
Regular Expressions: JavaScript And BeyondRegular Expressions: JavaScript And Beyond
Regular Expressions: JavaScript And Beyond
 
Php & my sql
Php & my sqlPhp & my sql
Php & my sql
 
Regexp secrets
Regexp secretsRegexp secrets
Regexp secrets
 

Más de Lukas Renggli

Mastering Grammars with PetitParser
Mastering Grammars with PetitParserMastering Grammars with PetitParser
Mastering Grammars with PetitParserLukas Renggli
 
Natural Language Checking with Program Checking Tools
Natural Language Checking with Program Checking ToolsNatural Language Checking with Program Checking Tools
Natural Language Checking with Program Checking ToolsLukas Renggli
 
Dynamic Language Embedding With Homogeneous Tool Support
Dynamic Language Embedding With Homogeneous Tool SupportDynamic Language Embedding With Homogeneous Tool Support
Dynamic Language Embedding With Homogeneous Tool SupportLukas Renggli
 
Seaside — Agile Software Development
Seaside — Agile Software DevelopmentSeaside — Agile Software Development
Seaside — Agile Software DevelopmentLukas Renggli
 
Domain-Specific Program Checking
Domain-Specific Program CheckingDomain-Specific Program Checking
Domain-Specific Program CheckingLukas Renggli
 
Embedding Languages Without Breaking Tools
Embedding Languages Without Breaking ToolsEmbedding Languages Without Breaking Tools
Embedding Languages Without Breaking ToolsLukas Renggli
 
Language Boxes — Bending the Host Language with Modular Language Changes
Language Boxes — Bending the Host Language with Modular Language ChangesLanguage Boxes — Bending the Host Language with Modular Language Changes
Language Boxes — Bending the Host Language with Modular Language ChangesLukas Renggli
 
Seaside Status Message
Seaside Status MessageSeaside Status Message
Seaside Status MessageLukas Renggli
 
Seaside - The Revenge of Smalltalk
Seaside - The Revenge of SmalltalkSeaside - The Revenge of Smalltalk
Seaside - The Revenge of SmalltalkLukas Renggli
 
Seaside - On not getting bogged down
Seaside - On not getting bogged downSeaside - On not getting bogged down
Seaside - On not getting bogged downLukas Renggli
 
Seaside - Past, Present and Future
Seaside - Past, Present and FutureSeaside - Past, Present and Future
Seaside - Past, Present and FutureLukas Renggli
 
Magritte - A Meta-Driven Approach to Empower Developers and End Users
Magritte - A Meta-Driven Approach to Empower Developers and End UsersMagritte - A Meta-Driven Approach to Empower Developers and End Users
Magritte - A Meta-Driven Approach to Empower Developers and End UsersLukas Renggli
 
Transactional Memory for Smalltalk
Transactional Memory for SmalltalkTransactional Memory for Smalltalk
Transactional Memory for SmalltalkLukas Renggli
 
Seaside - Web Development As You Like It
Seaside - Web Development As You Like ItSeaside - Web Development As You Like It
Seaside - Web Development As You Like ItLukas Renggli
 
5 Steps to Mastering the Art of Seaside
5 Steps to Mastering the Art of Seaside5 Steps to Mastering the Art of Seaside
5 Steps to Mastering the Art of SeasideLukas Renggli
 

Más de Lukas Renggli (18)

Mastering Grammars with PetitParser
Mastering Grammars with PetitParserMastering Grammars with PetitParser
Mastering Grammars with PetitParser
 
Natural Language Checking with Program Checking Tools
Natural Language Checking with Program Checking ToolsNatural Language Checking with Program Checking Tools
Natural Language Checking with Program Checking Tools
 
Dynamic Language Embedding With Homogeneous Tool Support
Dynamic Language Embedding With Homogeneous Tool SupportDynamic Language Embedding With Homogeneous Tool Support
Dynamic Language Embedding With Homogeneous Tool Support
 
Seaside — Agile Software Development
Seaside — Agile Software DevelopmentSeaside — Agile Software Development
Seaside — Agile Software Development
 
Domain-Specific Program Checking
Domain-Specific Program CheckingDomain-Specific Program Checking
Domain-Specific Program Checking
 
Embedding Languages Without Breaking Tools
Embedding Languages Without Breaking ToolsEmbedding Languages Without Breaking Tools
Embedding Languages Without Breaking Tools
 
Language Boxes — Bending the Host Language with Modular Language Changes
Language Boxes — Bending the Host Language with Modular Language ChangesLanguage Boxes — Bending the Host Language with Modular Language Changes
Language Boxes — Bending the Host Language with Modular Language Changes
 
jQuery for Seaside
jQuery for SeasidejQuery for Seaside
jQuery for Seaside
 
Seaside Status Message
Seaside Status MessageSeaside Status Message
Seaside Status Message
 
Seaside - The Revenge of Smalltalk
Seaside - The Revenge of SmalltalkSeaside - The Revenge of Smalltalk
Seaside - The Revenge of Smalltalk
 
Magritte Blitz
Magritte BlitzMagritte Blitz
Magritte Blitz
 
Seaside - On not getting bogged down
Seaside - On not getting bogged downSeaside - On not getting bogged down
Seaside - On not getting bogged down
 
Magritte
MagritteMagritte
Magritte
 
Seaside - Past, Present and Future
Seaside - Past, Present and FutureSeaside - Past, Present and Future
Seaside - Past, Present and Future
 
Magritte - A Meta-Driven Approach to Empower Developers and End Users
Magritte - A Meta-Driven Approach to Empower Developers and End UsersMagritte - A Meta-Driven Approach to Empower Developers and End Users
Magritte - A Meta-Driven Approach to Empower Developers and End Users
 
Transactional Memory for Smalltalk
Transactional Memory for SmalltalkTransactional Memory for Smalltalk
Transactional Memory for Smalltalk
 
Seaside - Web Development As You Like It
Seaside - Web Development As You Like ItSeaside - Web Development As You Like It
Seaside - Web Development As You Like It
 
5 Steps to Mastering the Art of Seaside
5 Steps to Mastering the Art of Seaside5 Steps to Mastering the Art of Seaside
5 Steps to Mastering the Art of Seaside
 

Último

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Último (20)

GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Dynamic grammars

  • 1. Dynamic Grammars Lukas Renggli, Stéphane Ducasse, Tudor Gîrba, Oscar Nierstrasz
  • 2. grammar a set of rules governing what strings are valid or allowable in a [formal] language. [Adapted from The New Oxford American Dictionary on Grammar]
  • 3. 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]
  • 4. Dynamic Grammars Dynamic Languages ‣ Late-bound behavior ‣ First-class representation ‣ On-the-fly transformation ‣ Introspection and reflection
  • 6. Language and Tool Extensions Language Boxes Host Environment
  • 7. Language and Tool Extensions Language Boxes Grammars Dynamic Host Environment
  • 8. Language * Change Language * Language Box Concern * * Language Scope
  • 9. Language Change = δ Host Language Grammar
  • 10. Language Grammar = Change Transformation
  • 11. 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 ]
  • 12. ✖ 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 ]
  • 13. #( #[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] )
  • 14. ✖ #( #[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] )
  • 15.
  • 16. ID ::= letter { letter | digit } ; a..z a..z 0..9
  • 17. id := #letter , (#letter / #digit) star sequence letter star choice letter digit
  • 18. id := #letter asParser , (#letter asParser / #digit asParser) star sequence letter star choice letter digit
  • 23.
  • 26. #letter → #letter / $_ sequence letter star choice letter digit
  • 27. #letter → #letter / $_ sequence choice star letter _ choice choice digit letter _
  • 29. (`a / `b) / `c → `a / `b / `c sequence choice star letter _ choice choice digit letter _
  • 30. (`a / `b) / `c → `a / `b / `c sequence choice star letter _ choice letter _ digit
  • 31. (`a / `b) / `c → `a / `b / `c in general sequence a graph choice star letter _ choice letter _ digit
  • 33. SELECT * FROM users
  • 34. |r| r := SELECT * FROM users . ^ User fromRow: r
  • 36. <SQL: SELECT * FROM users>
  • 42. !expr sql / !sql expr expr | sql
  • 43. !expr sql / !sql expr / ui expr $ sql