1 / 20

DSL‘s

DSL‘s. Daniel Frey. Roadmap. Introduction Definitions Pros/Cons Samples. Introduction. Sample My way of experiencing DSL‘s Focus on language oriented DSL’s. Introduction / 2 . Why do we need DSL‘s?. Definitions. DSL

miranda
Download Presentation

DSL‘s

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. DSL‘s Daniel Frey

  2. Roadmap • Introduction • Definitions • Pros/Cons • Samples

  3. Introduction • Sample • My way of experiencing DSL‘s • Focus on language oriented DSL’s

  4. Introduction / 2 • Why do we need DSL‘s?

  5. Definitions • DSL • A computer programming language of limited expressiveness focused on a particular domain

  6. Definition / 2 • computer programming language • language nature • limited expressiveness • domain focus

  7. Styles of DSL‘s • Internal • External • Language Workbenches

  8. Language Workbench

  9. Sample Input File: #123456789012345678901234567890123456789012345678901234567890 SVCLFOWLER 10101MS0120050313......................... SVCLHOHPE 10201DX0320050315........................ SVCLTWO x10301MRP220050329........................... USGE10301TWO x50214..7050329.......................

  10. DSL 1 <?xml version="1.0" encoding="utf-8" ?> <ReaderConfiguration> <Mapping Code = "SVCL" TargetClass = "dsl.ServiceCall"> <Field name = "CustomerName" start = "4" end = "18"/> <Field name = "CustomerID" start = "19" end = "23"/> <Field name = "CallTypeCode" start = "24" end = "27"/> <Field name = "DateOfCallString" start = "28" end = "35"/> </Mapping> <Mapping Code = "USGE" TargetClass = "dsl.Usage"> <Field name = "CustomerID" start = "4" end = "8"/> <Field name = "CustomerName" start = "9" end = "22"/> <Field name = "Cycle" start = "30" end = "30"/> <Field name = "ReadDate" start = "31" end = "36"/> </Mapping> </ReaderConfiguration>

  11. Syntax • Abstract Syntax - concrete syntax

  12. DSL 2 mapping SVCL dsl.ServiceCall 4-18: CustomerName 19-23: CustomerID 24-27 : CallTypeCode 28-35 : DateOfCallString mapping USGE dsl.Usage 4-8 : CustomerID 9-22: CustomerName 30-30: Cycle 31-36: ReadDate

  13. DSL 3 mapping('SVCL', ServiceCall) do extract 4..18, 'customer_name' extract 19..23, 'customer_ID' extract 24..27, 'call_type_code' extract 28..35, 'date_of_call_string' end mapping('USGE', Usage) do extract 9..22, 'customer_name' extract 4..8, 'customer_ID' extract 30..30, 'cycle' extract 31..36, 'read_date' end

  14. Brownie Example take(MicrowaveableDish) do melt((1/4).cup.butter) mix :with => 6.tablespoon.cocoa add 1.cup.sugar, 2.egg, (1/2).teaspoon.vanilla, (1/3).cup.flour, (1/4).teaspoon.salt mix bake :in => BakingPan, :for => 40.minutes, :at => 325.degrees end

  15. RSpec • Demo

  16. Pro/Cons Evolving into Generality!

  17. Different DSL‘s • Why do we need DSL‘s? • Represent easily businessrules in code

  18. Different kinds of DSL‘ • Video

  19. Domain Experts • Read and understand • Not necessarly write!

More Related