Digibury: Edd Barrett - A Case Study in Cross-Language Tracing
Upcoming SlideShare
Loading in...5
×
 

Digibury: Edd Barrett - A Case Study in Cross-Language Tracing

on

  • 396 views

A talk exploring the challenges of programming language composition and how the team at King's College London propose to overcome them.

A talk exploring the challenges of programming language composition and how the team at King's College London propose to overcome them.

Statistics

Views

Total Views
396
Slideshare-icon Views on SlideShare
271
Embed Views
125

Actions

Likes
0
Downloads
0
Comments
0

4 Embeds 125

http://deeson-online.co.uk 117
http://cloud.feedly.com 5
http://alliprice1.devcloud.acquia-sites.com 2
http://feeds.feedburner.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

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

    Digibury: Edd Barrett - A Case Study in Cross-Language Tracing Digibury: Edd Barrett - A Case Study in Cross-Language Tracing Presentation Transcript

    • Language Composition A Case Study in Cross-Language Tracing Edd Barrett Carl Friedrich Bolz Laurence Tratt Naveneetha Krishnan Vasudevan Lukas Diekmann Software Development Team 2013-11-13 1 / 25 http://soft-dev.org/
    • Life is Good 2 / 25 http://soft-dev.org/
    • Life is Good 3D Engine 2 / 25 http://soft-dev.org/
    • Life is Good Mobile App 2 / 25 http://soft-dev.org/
    • Life is Good Quick Script 2 / 25 http://soft-dev.org/
    • That is, until... // A load of Android Java code... // find pairs where i + j < 10 Arraylist<int> result = new ArrayList(); for (int i : ints1) { for (int j : ints2) { if (i + j < 10) { ArrayList<int> n = new ArrayList(); n.add(i); n.add(j); result.add(n); } } } // More Android Java code... 3 / 25 http://soft-dev.org/
    • That is, until... // A load of Android Java code... # find pairs where i + j < 10 in *Python* result = [ (i, j) for i in ints1 for j in ints2 if i + j < 10 ] // More Android Java code... 3 / 25 http://soft-dev.org/
    • Or until... # Some Python code... if first == 1: if second == 1: return 999 elif second == 2: return 666 else: raise TrollException("naughty") elif first == 2: if second == 1: return 1337 elif second == 2: return 42 else: raise TrollException("naughty") else: raise TrollException("naughty") # More Python code... 4 / 25 http://soft-dev.org/
    • Or until... # Some Python code... (* Much easier to use pattern matching from functional world, e.g. Ocaml *) match (first, second) with | (1, 1) -> 999 | (1, 2) -> 666 | (2, 1) -> 1337 | (2, 2) -> 42 | _ -> raise (TrollException "naughty");; # More Python code... 4 / 25 http://soft-dev.org/
    • So what is my point? THE POINT: 5 / 25 http://soft-dev.org/
    • So what is my point? THE POINT: PL Wars! 5 / 25 http://soft-dev.org/
    • So what is my point? THE POINT: PL Wars! 5 / 25 http://soft-dev.org/
    • So what is my point? THE POINT: It would be sweet to compose programming languages. 5 / 25 http://soft-dev.org/
    • Language Composition PL X PL Z PL Y 6 / 25 http://soft-dev.org/
    • Not a New Idea Existing composition methods: Poor syntactic integration. Stringly-typed. Languages not born equal. One language hosts the other. Poor performance No cross-language optimisations. Too much engineering effort. 7 / 25 http://soft-dev.org/
    • What do we want from a language composition? 8 / 25 http://soft-dev.org/
    • What do we want from a language composition? High performance PL >>> 9 / 25 http://soft-dev.org/
    • What do we want from a language composition? Good syntactic integration pl x pl z pl y 9 / 25 http://soft-dev.org/
    • What do we want from a language composition? Little effort < 9 / 25 http://soft-dev.org/
    • Breaking down the problem 10 / 25 http://soft-dev.org/
    • Breaking Down the Problem PL X PL Z PL Y 11 / 25 http://soft-dev.org/
    • Breaking Down the Problem syntax PL X syntax runtime PL Z syntax runtime PL Y runtime 11 / 25 http://soft-dev.org/
    • Challenges: Syntactic Composition 12 / 25 http://soft-dev.org/
    • Parsing PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... 13 / 25 http://soft-dev.org/
    • Parsing PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... PL X <program> for (j : js) { doStuff(); } . . . 13 / 25 http://soft-dev.org/
    • Parsing PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... Parsing PL X <program> for (j : js) { doStuff(); } . . . 13 / 25 http://soft-dev.org/
    • Parsing PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... Parsing PL X <program> Parse Tree for (j : js) { doStuff(); } . . . 13 / 25 http://soft-dev.org/
    • Parsing PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... 14 / 25 http://soft-dev.org/
    • Parsing PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... PL Y <grammar> expr::= ... term::= ... | ... | ... func ::= ... 14 / 25 http://soft-dev.org/
    • Parsing PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... PL Y <grammar> PL Z <grammar> expr::= ... term::= ... | ... | ... func ::= ... expr::= ... term::= ... | ... | ... func ::= ... 14 / 25 http://soft-dev.org/
    • Parsing PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... PL Y <grammar> AMBI GUOU S PL Z <grammar> expr::= ... term::= ... | ... | ... func ::= ... expr::= ... term::= ... | ... | ... func ::= ... 14 / 25 http://soft-dev.org/
    • Parsing PL Z <grammar> AM expr::= ... term::= ... | ... | ... func ::= ... BI GU OU S PL Z <program> Parsing for (j : js) { doStuff(); } . . . 14 / 25 ? http://soft-dev.org/
    • Challenges: Runtime Composition 15 / 25 http://soft-dev.org/
    • Challenges: Runtime Composition PL X PL Y Interpreter Interpreter C/C++ 16 / 25 http://soft-dev.org/
    • Challenges: Runtime Composition PL X To o Interpreter PL Y sl Interpreter ow C/C++ 16 / 25 http://soft-dev.org/
    • Challenges: Runtime Composition JIT Compiler JIT Compiler PL X PL Y Interpreter Interpreter C/C++ 16 / 25 http://soft-dev.org/
    • Challenges: Runtime Composition JIT Compiler JIT Compiler PL e Too X n PL Y gi mu Interpreter ne ch er in g Interpreter C/C++ 16 / 25 http://soft-dev.org/
    • Challenges: Runtime Composition PL X PL Y Interpreter Interpreter JVM/CLR 16 / 25 JIT Compiler http://soft-dev.org/
    • Challenges: Runtime Composition fo Poo r r dy pe na Interpreter rfo Interpreter mi rm c la anc ng e ua ge s JIT Compiler PL X PL Y JVM/CLR 16 / 25 http://soft-dev.org/
    • Our Proposed Solution 17 / 25 http://soft-dev.org/
    • Proposed solution Meta-tracing + Language Boxes 18 / 25 http://soft-dev.org/
    • Meta-tracing Meta-tracing 19 / 25 http://soft-dev.org/
    • PL Interpreter Meta-tracing Meta-tracing 20 / 25 PL Interpreter Tracing JIT http://soft-dev.org/
    • PL X PL Y Interpreters Glue Meta-tracing RPython Meta-tracing 20 / 25 PL Z Interpreter Tracing JIT http://soft-dev.org/
    • PL X PL Y Meta-tracing Meta-tracing PL Z Good perfo rmance Interpreters Glue 20 / 25 Interpreter Tracing JIT http://soft-dev.org/
    • PL X PL Y Meta-tracing Meta-tracing PL Z Good perfo rmance Interpreters Glue Interpreter Tracing JIT Little effort 20 / 25 http://soft-dev.org/
    • Meta-tracing Language Boxes 21 / 25 http://soft-dev.org/
    • Language Boxes Editor Suppose we want to write a Java + SQL program. 22 / 25 http://soft-dev.org/
    • Language Boxes Editor Suppose we want to write a Java + SQL program. Begin writing Java code for (string s : 22 / 25 http://soft-dev.org/
    • Language Boxes Editor Suppose we want to write a Java + SQL program. for (string s : Open SQL language box 22 / 25 http://soft-dev.org/
    • Language Boxes Editor Suppose we want to write a Java + SQL program. Write SQL code for (string s : SELECT * FROM tbl WHERE 22 / 25 http://soft-dev.org/
    • Language Boxes Editor Suppose we want to write a Java + SQL program. SELECT * FROM tbl WHERE name = this.name;) { for (string s : Java code 22 / 25 http://soft-dev.org/
    • Language Boxes Editor Suppose we want to write a Java + SQL program. Good Syntact ic Integrati on SELECT * FROM tbl WHERE name = this.name;) { for (string s : Java code 22 / 25 http://soft-dev.org/
    • Language Boxes Editor Suppose we want to write a Java + SQL program. Good Syntact ic Integrati on SELECT * FROM tbl WHERE name = this.name;) { y for (string s : Avoids Ambiguit Java code 22 / 25 http://soft-dev.org/
    • Language Boxes Editor Suppose we want to write a Java + SQL program. Good Syntact ic Integrati on NeedSELECT omFROM tbl WHERE for (string s : s Cust * Editor name = this.name;) { Avoids Ambiguity Java code 22 / 25 http://soft-dev.org/
    • Our First Composition 23 / 25 http://soft-dev.org/
    • Unipycation Interpreters Glue Unipycation Prolog RPython Python Interpreter Tracing JIT + our language box editor (eco) 24 / 25 http://soft-dev.org/
    • Thanks SELECT * FROM tbl WHERE name = this.name;) { for (string s : Java code Interpreters Glue Unipycation Prolog RPython Python Interpreter Tracing JIT http://soft-dev.org 25 / 25 http://soft-dev.org/