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

What if we could change programming languages?

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

Kolja Dummann

February 02, 2014
Tweet

More Decks by Kolja Dummann

Other Decks in Programming

Transcript

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

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

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

    time = …; int16/mps/ speed = distance / time; sensor self destruction vanes autopilot pumps sensor
  4. 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(); } } }
  5. 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
  6. 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
  7. Image: Wikipedia Commons Undefined Behavior i *= 2 + 2

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

    + i--; sensor self destruction vanes autopilot pumps sensor (i *= 2 + 2 + i)——; You write: GCC reads:
  9. 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
  10. LocalVarDecl Name = i IntType Type Plus Init NumberLiteral Name

    = 42 Left NumberLiteral Value = 23 Right int i = 42 + 23;