Advanced IDE functionality in modern language workbenches

  • 542 views
Uploaded on

The presentation of MPS at CodeGeneration 2012

The presentation of MPS at CodeGeneration 2012

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
542
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
7
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • Vaclav, Alex\n
  • \n
  • Notice how old the definition of structure, editor and generator is\n
  • A\n
  • A\n- First give a short look in core/boring aspects of language definition\n- cover advanced IDE functionality \n- show examples from MPS\n- believe all these aspects are important for other LWches, so we will highlight challenges important for particular aspect implementation step-by-step during the presentation\n
  • V\n
  • A\n
  • A\n
  • A\n
  • V\n
  • A\n
  • V\n
  • A\n
  • V\nDemo\n
  • A\nTextual-based IDEs need these as well\n\n
  • V\n
  • A\n
  • A\n
  • V\n
  • A, V\n
  • A\n
  • V\n
  • A\nA declarative DSL\n
  • V\nStatic analysis of the code in the IDE and during the build process\n
  • V\n
  • V\n
  • V\n
  • \n
  • A\n
  • A\n
  • \n
  • A\n
  • A\n
  • V\n
  • V\n
  • \n
  • A\n
  • V\nMartin Fowler identified as one of the “real” DSL problems\n
  • A\n- Single huge monster-DSL covering all aspects is not our target\n- The point is to make it possible to design set of smaller DSLs working with each other using extensibility provided by Language Workbench\n- Except the fact it’s good way to design DSLs in general, we feel it should simplify adoption of DSLs in software development world\n
  • A\nRefer to Markus\n
  • V\nScreen-shot\n
  • V\n
  • \n

Transcript

  • 1. JetBrains MPSDeveloping advanced IDE functionality for your DSLs Alexander Shatalin Václav Pech JetBrains, Inc. www.jetbrains.com 1
  • 2. GoalWe’ve gone a long way charting the territoryand want to share our part of the map => to initiate discussion and ideas www.jetbrains.com 2
  • 3. Language Workbench■ Users can freely define new languages which are fully integrated with each other.■ The primary source of information is a persistent abstract representation.■ Language designers define a DSL in three main parts: schema, editor(s), and generator(s).■ Language users manipulate a DSL through a projectional editor.■ A language workbench can persist incomplete or contradictory information in its abstract representation. Martin Fowler www.jetbrains.com 3
  • 4. JetBrains MPSMPS stands for Meta Programming SystemJetBrains MPS is an environment for:- defining new languages and language extensions- writing and running/debugging programs in theselanguages www.jetbrains.com 4
  • 5. Agenda• Abstract and concrete syntax• Generation• Type-system• Dataflow• Version Control Support• Debugging• Testing• Refactoring• Extensibility & Modularization www.jetbrains.com 5
  • 6. Categorization Parser-based x Projectional www.jetbrains.com 6
  • 7. Abstract syntax www.jetbrains.com 7
  • 8. Node definition www.jetbrains.com 8
  • 9. Structural constraints Type of a property Child cardinality www.jetbrains.com 9
  • 10. Model Validation www.jetbrains.com 10
  • 11. Behavior www.jetbrains.com 11
  • 12. Annotations/AttributesSeamlessly add children to existing conceptsin a generic way www.jetbrains.com 12
  • 13. Annotations/Attributes www.jetbrains.com 13
  • 14. Concrete syntaxEditor www.jetbrains.com 14
  • 15. Actions and IntentionsImprove the user experience in the editor www.jetbrains.com 15
  • 16. GeneratorModel to modeltransformationModel to textgeneration www.jetbrains.com 16
  • 17. Editing target language templatesIDE support requiredThis is model-to-model transformation www.jetbrains.com 17
  • 18. Text generation www.jetbrains.com 18
  • 19. Our goalUse the same language for all generation steps www.jetbrains.com 19
  • 20. ChallengesUse template language in text generationGood IDE support in templatesExtensible generatorsFast is good Incremental generation In the background - in an outside process Parallel generator www.jetbrains.com 20
  • 21. Type-systemFast and ExtensibleVisible in other aspects (e.g. actions)Type-system is described through a DSL www.jetbrains.com 21
  • 22. Type-system rulesType equality, inequalityReplacement, Sub-typing, Comparison andChecking rules www.jetbrains.com 22
  • 23. Type-system rules www.jetbrains.com 23
  • 24. DataflowDead codePotential NPE... www.jetbrains.com 24
  • 25. Unreachable code www.jetbrains.com 25
  • 26. Potential NPE www.jetbrains.com 26
  • 27. Dataflow AnalyzersCustomized dataflow validation www.jetbrains.com 27
  • 28. Version Control supportVersion control integration should beimplemented for projectional editorssimilar to text-based IDE approach www.jetbrains.com 28
  • 29. DebuggerUseful for development of IDE aspects for DSLas well as for any other SW developmentApplication x language debugging www.jetbrains.com 29
  • 30. Debugging MPS Type System rule www.jetbrains.com 30
  • 31. MPS Type System trace www.jetbrains.com 31
  • 32. ChallengesImprove debugger definition to abstract it fromfinal target languageProvide access to DSL variables in evaluation www.jetbrains.com 32
  • 33. TestingThere are two aspects of testing a DSL: IDE functionality Code generatorJUnit extensions used in MPS type-system testing, editor testing, ... www.jetbrains.com 33
  • 34. Testing IDE functionality www.jetbrains.com 34
  • 35. Testing IDE functionality www.jetbrains.com 35
  • 36. Testing Code generatorExecute code generator upon test set of inputmodels/programs & check there are no errorsCompare generated code with same codegenerated beforeCompile generated codeRun generated code www.jetbrains.com 36
  • 37. ChallengesProviding support for testing IDE aspects ofDSLsNo support from MPS side for runninggenerated code nowConvince the developers to write tests www.jetbrains.com 37
  • 38. RefactoringA well-known problemSolutions: Packaged refactorings (e.g. Eclipse) Preserved refactorings Migration scripts Language versioning www.jetbrains.com 38
  • 39. ExtensibilityDSLs must be extensibleUse set of languages instead of single hugeDSLModular DSL design should simplify DSLadoption www.jetbrains.com 39
  • 40. How to develop better DSLs?One way: Lower the barrier to entry Integrate with common-place IDEs www.jetbrains.com 40
  • 41. SummarySpread the DSL idea far and wide ... www.jetbrains.com 41
  • 42. Q&AThank you! www.jetbrains.com 42