Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What if we could change programming languages?

747ee5b01d0969d624683652122fd377?s=47 Kolja Dummann
February 02, 2014

What if we could change programming languages?

Slides form my talk about haw we used language extensions to build mbeddr at FOSDEM2014

747ee5b01d0969d624683652122fd377?s=128

Kolja Dummann

February 02, 2014
Tweet

Transcript

  1. What if we could change programming languages?

  2. Kolja Dummann itemis AG ! @dumdidum http://logv.ws

  3. Rocket Science? Image: mentalwanderings / CC-by-sa

  4. Rocket Science! Image: mentalwanderings / CC-by-sa

  5. Build your own rocket software Image: Wikipedia Commons

  6. Image: Wikipedia Commons

  7. Image: Wikipedia Commons sensor

  8. Image: Wikipedia Commons sensor self destruction

  9. Image: Wikipedia Commons sensor self destruction autopilot

  10. Image: Wikipedia Commons sensor self destruction autopilot sensors

  11. Image: Wikipedia Commons sensor self destruction autopilot pumps sensors

  12. Image: Wikipedia Commons sensor self destruction vanes autopilot pumps sensors

  13. Image: Wikipedia Commons Physical Units int16 distance = …; int16

    time = …; int16 speed = time / distance; sensor self destruction vanes autopilot pumps sensor
  14. Image: Wikipedia Commons Physical Units int16 distance = …; int16

    time = …; int16 speed = time / distance; sensor self destruction vanes autopilot pumps sensor
  15. Image: Wikipedia Commons Physical Units int16/m/ distance = …; int16/s/

    time = …; int16/mps/ speed = distance / time; sensor self destruction vanes autopilot pumps sensor
  16. Image: Wikipedia Commons sensor self destruction vanes autopilot pumps sensor

    Statemachines statemachine selfdestruction initial = starting { in event update(int8 speed, int8 hight) <no binding> state starting { on update [speed > 10 && hight > 0] -> flying } state flying { do { record_flightdata(); } on update [speed > 100 && hight < 42] -> kill } state kill { entry { blow_rocket(); } } }
  17. Image: Wikipedia Commons Components cs interface FlightRecorder { Trackpoint* process(Trackpoint*

    p) pre(0) p != null pre(1) p->id != 0 pre(2) p->time != 0 s post(3) result->id != 0 } sensor self destruction vanes autopilot pumps sensor
  18. Image: Wikipedia Commons Components II component AutoPilot extends nothing {

    requires FlightRecorder flightRecorder provides CourseProvider cp int16 cp_getCourse() <= op cp.getCourse { return 0; } } sensor self destruction vanes autopilot pumps sensor
  19. Image: Wikipedia Commons Undefined Behavior sensor self destruction vanes autopilot

    pumps sensor
  20. Image: Wikipedia Commons Undefined Behavior i *= 2 + 2

    + i--; sensor self destruction vanes autopilot pumps sensor You write:
  21. Image: Wikipedia Commons Undefined Behavior i *= 2 + 2

    + i--; sensor self destruction vanes autopilot pumps sensor (i *= 2 + 2 + i)——; You write: GCC reads:
  22. Image: Wikipedia Commons Testing testcase main { assert-equals(0) 10 ==

    add(5, 5); assert-less(1) 20 < add(5, 10); assert(2) 30 == add(20, 10); } sensor self destruction vanes autopilot pumps sensor
  23. Image: Wikipedia Commons Verification sensor self destruction vanes autopilot pumps

    sensor
  24. How?

  25. Projectional Editor

  26. int i = 42 + 23;

  27. int i = 42 + 23;

  28. LocalVarDecl Name = i int i = 42 + 23;

  29. LocalVarDecl Name = i IntType Type int i = 42

    + 23;
  30. LocalVarDecl Name = i IntType Type Plus Init int i

    = 42 + 23;
  31. LocalVarDecl Name = i IntType Type Plus Init NumberLiteral Name

    = 42 Left int i = 42 + 23;
  32. LocalVarDecl Name = i IntType Type Plus Init NumberLiteral Name

    = 42 Left NumberLiteral Value = 23 Right int i = 42 + 23;
  33. Abstract Syntax Tree Concrete Syntax

  34. Abstract Syntax Tree Concrete Syntax

  35. Abstract Syntax Tree Concrete Syntax

  36. Abstract Syntax Tree Concrete Syntax

  37. Abstract Syntax Tree Concrete Syntax

  38. Abstract Syntax Tree Concrete Syntax

  39. Abstract Syntax Tree Concrete Syntax

  40. Abstract Syntax Tree Concrete Syntax

  41. http://mbeddr.com

  42. A Open Source Collection of integrated languages for embedded software

    engineering
  43. None
  44. Core Plain C

  45. Core Plain C Ext Components Statemachines Units

  46. Core Plain C Ext Components Statemachines Units CC Requirements Documentation

  47. Core Plain C Ext Components Statemachines Units CC Requirements Documentation

    Debugger
  48. Core Plain C Ext Components Statemachines Units CC Requirements Documentation

    Analyses Debugger
  49. Code Generator Text (C) Compiler

  50. Build on JetBrains MPS Open Source Language Workbench Apache 2.0

    http://jetbrains.com/mps
  51. Questions?