Language Boxes
          Bending the Host Language
       with Modular Language Changes

Lukas Renggli, Marcus Denker, Osc...
Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
§
§
    §

            Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
§
§
    §

            Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
Host Environment
Tool Infrastructure




Host Environment
Syntax

Language 1
              Editor



             Compiler
Language 2

             Debugger
Syntax

Language 1
              Editor



             Compiler
Language 2

             Debugger
Syntax

Language 1
              Editor



             Compiler
Language 2

             Debugger
Syntax

Language 1
              Editor



             Compiler
Language 2

             Debugger
Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
Tool Infrastructure




Host Environment
Language Boxes




Tool Infrastructure




Host Environment
Language Box
   Model
Language
               *
                    Change


Language       *   Language
  Box               Concern
           ...
IV + VII = XI
Language
               *
                    Change


Language       *   Language
  Box               Concern
           ...
Language Change




       Insert FRAGMENT
  (before|after) PRODUCTION
as (choice|sequence|replacement)
Language Change




Insert RomanNumber
before NumberLiteral
    as a choice.
Language Change


Literal:                 BooleanLiteral

                            NilLiteral

                       ...
Language Change




RomanNumber:       'I' .. 'M'
Language Change


Literal:             BooleanLiteral

                        NilLiteral

                     NumberLite...
Language Change




1st   Class Grammar
      Scannerless, Packrat
Language Concern




Production Action
Language Concern




       Compiler
aToken value romanToArabic lift
Language Concern




Highlighting
aToken -> Color gray
Language Concern




Custom Actions
Language Scope




Active?
Language Scope




System
Language Scope




Packages
Language Scope




Classes
Language Scope




Methods
Language
               *
                    Change


Language       *   Language
  Box               Concern
           ...
Conflicts
Language   Language   Language   Language
  Box 1      Box 2      Box 3      Box 4
Language   Language   Language   Language
  Box 1      Box 2      Box 3      Box 4
Language   Language   Language   Language
  Box 1      Box 2      Box 3      Box 4
Language     Language   Language   Language
  Box 1        Box 2      Box 3      Box 4




ostGrammar
Language    Language     Language   Language
  Box 1       Box 2        Box 3      Box 4




           HostGrammar
Language   Language   Language    Language
  Box 1      Box 2      Box 3       Box 4




                                 ...
Language   Language   Language   Language
  Box 1      Box 2      Box 3      Box 4
HostGrammar'
con  sis t
mi  gh t         rts
       us e d pa
o f un

               HostGrammar'
con  sis t            m igh t b
mi  gh t         rts          am big u    e
       us e d pa                       o us
o ...
PackratParser




HostGrammar'
SELECT * FROM users
<SQL: SELECT * FROM users>
Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
scg.unibe.ch/research/helvetia
Language Boxes — Bending the Host Language with Modular Language Changes
Language Boxes — Bending the Host Language with Modular Language Changes
Upcoming SlideShare
Loading in …5
×

Language Boxes — Bending the Host Language with Modular Language Changes

2,151 views
2,010 views

Published on

As domain-specific modeling begins to attract widespread acceptance, pressure is increasing for the development of new domain-specific languages. Unfortunately these DSLs typically conflict with the grammar of the host language, making it difficult to compose hybrid code except at the level of strings; few mechanisms (if any) exist to control the scope of usage of multiple DSLs; and, most seriously, existing host language tools are typically unaware of the DSL extensions, thus hampering the development process. Language boxes address these issues by offering a simple, modular mechanism to encapsulate (i) compositional changes to the host language, (ii) transformations to address various concerns such as compilation and syntax highlighting, and (iii) scoping rules to control visibility of fine-grained language extensions.
We describe the design and implementation of language boxes, and show with the help of several examples how modular extensions can be introduced to a host language and environment.

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,151
On SlideShare
0
From Embeds
0
Number of Embeds
594
Actions
Shares
0
Downloads
7
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Language Boxes — Bending the Host Language with Modular Language Changes

  1. 1. Language Boxes Bending the Host Language with Modular Language Changes Lukas Renggli, Marcus Denker, Oscar Nierstrasz
  2. 2. Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  3. 3. Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  4. 4. Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  5. 5. § § § Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  6. 6. Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  7. 7. Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  8. 8. Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  9. 9. § § § Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  10. 10. Host Environment
  11. 11. Tool Infrastructure Host Environment
  12. 12. Syntax Language 1 Editor Compiler Language 2 Debugger
  13. 13. Syntax Language 1 Editor Compiler Language 2 Debugger
  14. 14. Syntax Language 1 Editor Compiler Language 2 Debugger
  15. 15. Syntax Language 1 Editor Compiler Language 2 Debugger
  16. 16. Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  17. 17. Tool Infrastructure Host Environment
  18. 18. Language Boxes Tool Infrastructure Host Environment
  19. 19. Language Box Model
  20. 20. Language * Change Language * Language Box Concern * * Language Scope
  21. 21. IV + VII = XI
  22. 22. Language * Change Language * Language Box Concern * * Language Scope
  23. 23. Language Change Insert FRAGMENT (before|after) PRODUCTION as (choice|sequence|replacement)
  24. 24. Language Change Insert RomanNumber before NumberLiteral as a choice.
  25. 25. Language Change Literal: BooleanLiteral NilLiteral NumberLiteral StringLiteral ArrayLiteral NumberLiteral: IntegerLiteral FloatLiteral
  26. 26. Language Change RomanNumber: 'I' .. 'M'
  27. 27. Language Change Literal: BooleanLiteral NilLiteral NumberLiteral' StringLiteral ArrayLiteral NumberLiteral': RomanNumber NumberLiteral
  28. 28. Language Change 1st Class Grammar Scannerless, Packrat
  29. 29. Language Concern Production Action
  30. 30. Language Concern Compiler aToken value romanToArabic lift
  31. 31. Language Concern Highlighting aToken -> Color gray
  32. 32. Language Concern Custom Actions
  33. 33. Language Scope Active?
  34. 34. Language Scope System
  35. 35. Language Scope Packages
  36. 36. Language Scope Classes
  37. 37. Language Scope Methods
  38. 38. Language * Change Language * Language Box Concern * * Language Scope
  39. 39. Conflicts
  40. 40. Language Language Language Language Box 1 Box 2 Box 3 Box 4
  41. 41. Language Language Language Language Box 1 Box 2 Box 3 Box 4
  42. 42. Language Language Language Language Box 1 Box 2 Box 3 Box 4
  43. 43. Language Language Language Language Box 1 Box 2 Box 3 Box 4 ostGrammar
  44. 44. Language Language Language Language Box 1 Box 2 Box 3 Box 4 HostGrammar
  45. 45. Language Language Language Language Box 1 Box 2 Box 3 Box 4 HostGramm
  46. 46. Language Language Language Language Box 1 Box 2 Box 3 Box 4
  47. 47. HostGrammar'
  48. 48. con sis t mi gh t rts us e d pa o f un HostGrammar'
  49. 49. con sis t m igh t b mi gh t rts am big u e us e d pa o us o f un HostGrammar'
  50. 50. PackratParser HostGrammar'
  51. 51. SELECT * FROM users
  52. 52. <SQL: SELECT * FROM users>
  53. 53. Marco Zanoli, cc-by-sa, 2.5, www.wikipedia.de, 2006
  54. 54. scg.unibe.ch/research/helvetia

×