Concepts of JetBrains MPS
Upcoming SlideShare
Loading in...5
×
 

Concepts of JetBrains MPS

on

  • 995 views

An introductory presentation in JetBrains MPS

An introductory presentation in JetBrains MPS

Statistics

Views

Total Views
995
Views on SlideShare
995
Embed Views
0

Actions

Likes
0
Downloads
4
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Ruby on Rails as a DSL success story <br /> Spring dynamically loading generated Groovy (Ruby) <br /> YouTrack + other projects building on MPS <br />

Concepts of JetBrains MPS Concepts of JetBrains MPS Presentation Transcript

  • MPS Are you talking my language? Václav Pech
  • Future
  • Code orchestra
  • mbeddr
  • YouTrack
  • Karel
  • High thoughts must have high language. Aristophanes
  • DSL A DSL is a focussed, processable language for describing a specific concern when building a system in a specific domain. The abstractions and notations used are natural/suitable for the stakeholders who specify that particular concern. Markus Voelter
  • Cypher for Neo4j START john=node:node_auto_index(name = 'John') MATCH john-[:friend]->()-[:friend]->fof RETURN john, fof http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html
  • Grails Customer.findAllByNameAndAgeBetween('Joe', 20, 40) class Phone { .... static belongsTo = [owner : Person] }
  • Spock (Groovy) class DataDriven extends Specification { def "maximum of two numbers"() { expect: Math.max(a, b) == c where: a|b|c 7|3|7 4|5|5 9|9|9 }} http://code.google.com/p/spock/
  • JMock context.checking(new Expectations() {{ oneOf (clock).time(); will(returnValue(loadTime)); oneOf (clock).time(); will(returnValue(fetchTime)); allowing (reloadPolicy).shouldReload(loadTime, fetchTime); will(returnValue(false)); }}); http://www.jmock.org/expectations.html
  • DSLs with the benefits of General Purpose Langs
  • Abstract Syntax Tree
  • Abstract Syntax Tree
  • Programs are trees R Models composed of nodes A B C E D F G
  • Programs are trees R A IfStatement condition Expr E body StmtList F G
  • References cross the tree R A B C E D F G
  • Languages are sets of concepts C1 L Cn C2 C3
  • Programs and Languages C1 Cn R L A C2 Meta-models consist of concepts B C E C3 D F Models consist of nodes G
  • Programs and Languages WhileLoop MethodDef R L A IfStatement Meta-models consist of concepts B C E MethodCall D F Models consist of nodes G
  • Concept inheritance C1 C2 L1 C3 C4 L2 C5
  • Domain Hierarchy D2.1.1 D2.1.2 ... D2.2.1 D2.2.2 D1.1 D1.2 D0 More specialized domains More specialized languages ...
  • Language modularization Categorization proposed by Markus Voelter, http://http://voelter.de/
  • Projectional editor The coding experience is different (better :) Cooperate with the existing text tool-chain
  • Non-parseable notations
  • Multiple projections
  • Language combinations
  • Language combinations
  • Making Java in MPS better
  • Collections cities.where({~it => it.startsWith("P"); }) .select({~it => it.toUpperCase(); }) cities.any({~it => it.size() > populationLimit; })
  • Closures {int => long} fact = {int n => if (n == 1) { return 1L; } else { return n * invoke(n - 1); } };
  • Date/Time datetime start = now in (Europe/Berlin); ...... period processingTime = now in (Europe/Berlin) – start; datetime meeting = now in (GMT) + 2 days with (hours = 11) with (minutes = 0) with (seconds = 0)
  • And a lot more Tuples Regular expressions Builders XML processing Unit testing Custom operators And others ...
  • Java-MPS interoperability Java into MPS Integrate Java sources Import Java sources Import a library Paste Java code snippets
  • Java-MPS interoperability MPS into Java Generate into a Java project IDE plugin
  • Java IDE integration Design DSLs in MPS Use them in – – – – IntelliJ IDEA Standalone IDE (on IntelliJ platform) Web Eclipse
  • Aspects of language definition ● Abstract syntax ● Concrete syntax (editor) ● Static semantics ● Constraints ● Type-system ● Dataflow ● Execution semantics / Generator ● IDE support
  • Aspects of language definition ● Abstract syntax ● Concrete syntax (editor) ● Static semantics ● Constraints ● Type-system ● Dataflow ● Execution semantics / Generator ● IDE support
  • Example: Range Iterator
  • Structure Statement
  • Integration points Statement
  • Integration points Expression numberOfIterations
  • Integration points Expression numberOfIterations StatementList body
  • Integration points Expression numberOfIterations StatementList body
  • Structure Define the abstract syntax new concepts for nodes to use in the AST
  • Structure Define the abstract syntax new concepts for nodes to use in the AST
  • Aspects of language definition ● Abstract syntax ● Concrete syntax (editor) ● Static semantics ● Constraints ● Type-system ● Dataflow ● Execution semantics / Generator ● IDE support
  • Editor Define the concrete syntax the projection on the screen
  • Styling the editor
  • Aspects of language definition ● Abstract syntax ● Concrete syntax (editor) ● Static semantics ● Constraints ● Type-system ● Dataflow ● Execution semantics / Generator ● IDE support
  • Code generation Java source
  • Code generation MPS BaseLang Text generation Java source
  • Code generation Closures Date/Time Model to model transformation MPS BaseLang Text generation Java source
  • Code generation Custom 2 Custom 1 Model to model transformation Closures Date/Time Model to model transformation MPS BaseLang Text generation Java source
  • Generator Transform the new concept into BaseLanguage
  • mbeddr.com
  • What to expect? Graphical notations Web-base editor Eclipse integration … and a lot more
  • Grasp the subject, the words will follow. Cato the Elder
  • Questions Want more? http://www.jetbrains.com/mps http://jetbrains.dzone.com vaclav@jetbrains.com
  • Image credits http://www.flickr.com/photos/horiavarlan/4329908160/sizes/m/in/photostream/ http://www.flickr.com/photos/pink_floyd/2409134519/sizes/m/in/photostream/ http://www.flickr.com/photos/atache/4124732863/sizes/m/in/photostream/ http://www.flickr.com/photos/a_ninjamonkey/3294014627/sizes/m/in/photostream/ http://www.flickr.com/photos/carlc/1968636137/ http://www.flickr.com/photos/tasuki/3503304405/sizes/m/in/photostream/ http://www.flickr.com/photos/bmwccgb/5069454884/sizes/m/in/photostream/ http://www.flickr.com/photos/rpmarks/3932013183/sizes/m/in/photostream/ http://www.flickr.com/photos/orqwith/4325166853/