Fine-grained language composition Edd Barrett, Carl Friedrich Bolz, Lukas Diekmann, Geoff French, Sarah Mount, Laurence Tratt, Naveneetha Krishnan Vasudevan Software Development Team 2016-01-28 1 / 28 http://soft-dev.org/
Background Background ABCgjy 2 / 28 http://soft-dev.org/
Background Background A perfect programming language 2 / 28 http://soft-dev.org/
Background Background Solution ABCgjy 3 / 28 http://soft-dev.org/
Background Background Solution A new programming language 3 / 28 http://soft-dev.org/
Background Background Reality ABCgjy 3 / 28 http://soft-dev.org/
Background Background Reality Another imperfect programming language 3 / 28 http://soft-dev.org/
What to expect from this talk What to expect from this talk A B 4 / 28 http://soft-dev.org/
What to expect from this talk What to expect from this talk gA ∪ Bg 4 / 28 http://soft-dev.org/
What to expect from this talk What to expect from this talk Python ∪ Prolog 4 / 28 http://soft-dev.org/
What to expect from this talk What to expect from this talk Python ∪ PHP 4 / 28 http://soft-dev.org/
Two levels of challenge Two levels of challenge Tooling 5 / 28 http://soft-dev.org/
Two levels of challenge Two levels of challenge Tooling Language friction 5 / 28 http://soft-dev.org/
Tooling challenges Tooling challenges 6 / 28 http://soft-dev.org/
Tooling challenges Tooling challenges Python PyHyp PHP 6 / 28 http://soft-dev.org/
Tooling challenges Tooling challenges syntax Python runtime syntax PyHyp runtime syntax PHP runtime 6 / 28 http://soft-dev.org/
Tooling challenges Tooling challenges syntax Language boxes Python runtime syntax PyHyp runtime syntax PHP runtime 6 / 28 http://soft-dev.org/
Tooling challenges Tooling challenges syntax Language boxes Python runtime syntax PyHyp runtime syntax PHP Composed runtime meta-tracing VMs 6 / 28 http://soft-dev.org/
Parsing: recognising Parsing: recognising 7 / 28 http://soft-dev.org/
Parsing: recognising Parsing: recognising Input: Bill hits Ben 7 / 28 http://soft-dev.org/
Parsing: recognising Parsing: recognising Input: Bill hits Ben Grammar: noun verb noun 7 / 28 http://soft-dev.org/
Parsing: Context-Free Grammars Parsing: Context-Free Grammars Expr ::= Expr ’+’ Term | Term Term ::= Term ’*’ Factor | Factor Factor ::= ’(’ Expr ’)’ | ’INT’ 8 / 28 http://soft-dev.org/
Parsing: Context-Free Grammars Parsing: Context-Free Grammars Expr ::= Expr ’+’ Term | Term Term ::= Term ’*’ Factor | Factor Factor ::= ’(’ Expr ’)’ | ’INT’ 8 / 28 http://soft-dev.org/
Parsing: Context-Free Grammars Parsing: Context-Free Grammars Expr ::= Expr ’+’ Term | Term Term ::= Term ’*’ Factor | Factor Factor ::= ’(’ Expr ’)’ | ’INT’ 8 / 28 http://soft-dev.org/
Parsing: Context-Free Grammars Parsing: Context-Free Grammars Expr ::= Expr ’+’ Term | Term Term ::= Term ’*’ Factor | Factor Factor ::= ’(’ Expr ’)’ | ’INT’ 8 / 28 http://soft-dev.org/
Parsing: Context-Free Grammars Parsing: Context-Free Grammars Expr ::= Expr ’+’ Term | Term Term ::= Term ’*’ Factor | Factor Factor ::= ’(’ Expr ’)’ | ’INT’ 8 / 28 http://soft-dev.org/
Parsing: Trees Parsing: Trees 2 + 3 Expr Expr T erm T erm Factor Factor 3 2 9 / 28 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... PL Y <program> for (j : js) { doStuff(); } . . . 10 / 28 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... Parser PL Y <program> for (j : js) { doStuff(); } . . . 10 / 28 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... Parser PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 10 / 28 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... LR PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 10 / 28 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... Generalised PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 10 / 28 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... PEG PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 10 / 28 http://soft-dev.org/
The only choice? The only choice? 11 / 28 http://soft-dev.org/
The only choice? The only choice? SDE 11 / 28 http://soft-dev.org/
The challenge The challenge Challenge: SDE’s power + a text editor feel? 12 / 28 http://soft-dev.org/
Eco demo Eco demo 13 / 28 http://soft-dev.org/
Runtime composition Runtime composition 14 / 28 http://soft-dev.org/
Runtime composition Runtime composition PL X PL Y Interpreter Interpreter C/C++ 14 / 28 http://soft-dev.org/
Runtime composition Runtime composition PL X PL Y Too slow Interpreter Interpreter C/C++ 14 / 28 http://soft-dev.org/
Runtime composition Runtime composition JIT Compiler JIT Compiler PL X PL Y Interpreter Interpreter C/C++ 14 / 28 http://soft-dev.org/
Runtime composition Runtime composition JIT Compiler JIT Compiler PL X PL Y Too much engineering Interpreter Interpreter C/C++ 14 / 28 http://soft-dev.org/
Runtime composition Runtime composition PL X PL Y Interpreter Interpreter JVM/CLR JIT Compiler 14 / 28 http://soft-dev.org/
Runtime composition Runtime composition PL X PL Y Semantic mismatch Interpreter Interpreter JVM/CLR JIT Compiler 14 / 28 http://soft-dev.org/
Runtime composition Runtime composition 14 / 28 http://soft-dev.org/
Runtime composition Runtime composition Meta-tracing PL X PL Y PL Z RPython Interpreters Interpreter Tracing JIT Glue 14 / 28 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter 15 / 28 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter translator RPython 15 / 28 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter translator RPython Optimised JIT Interpreter 15 / 28 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter translator RPython Optimised JIT Interpreter 15 / 28 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter translator RPython Optimised JIT Interpreter 15 / 28 http://soft-dev.org/
Runtime composition recap Runtime composition recap 16 / 28 http://soft-dev.org/
Runtime composition recap Runtime composition recap Meta-tracing PL X PL Y PL Z RPython Interpreters Interpreter Tracing JIT Glue 16 / 28 http://soft-dev.org/
Runtime composition recap Runtime composition recap Meta-tracing PyPy Hippy RPython PyHyp Interpreters Interpreter Tracing JIT Glue 16 / 28 http://soft-dev.org/
Composed Richards vs. other VMs Composed Richards vs. other VMs Type VM 9.475 ± 0.0127 CPython 2.7.7 4.264 ± 0.0386 HHVM 3.4.0 0.250 ± 0.0008 Mono HippyVM 0.178 ± 0.0006 PyPy 2.4.0 9.070 ± 0.0361 Composed Zend 5.5.13 17 / 28 http://soft-dev.org/
Composed Richards vs. other VMs Composed Richards vs. other VMs Type VM 9.475 ± 0.0127 CPython 2.7.7 4.264 ± 0.0386 HHVM 3.4.0 0.250 ± 0.0008 Mono HippyVM 0.178 ± 0.0006 PyPy 2.4.0 9.070 ± 0.0361 Composed Zend 5.5.13 0.335 ± 0.0012 Composed PyHyp 17 / 28 http://soft-dev.org/
Datatype conversion Datatype conversion PHPRoot PHPObject PHPInt PHPFunc 18 / 28 http://soft-dev.org/
Datatype conversion Datatype conversion PHPRoot PHPObject PHPInt PHPFunc PyRoot PyObject PyInt PyFunc 18 / 28 http://soft-dev.org/
Datatype conversion: primitive types Datatype conversion: primitive types Python PHP 19 / 28 http://soft-dev.org/
Datatype conversion: primitive types Datatype conversion: primitive types Python PHP 2 : PHPInt 19 / 28 http://soft-dev.org/
Datatype conversion: primitive types Datatype conversion: primitive types Python PHP 2 : PyInt 2 : PHPInt 19 / 28 http://soft-dev.org/
Datatype conversion: user types Datatype conversion: user types Python PHP 20 / 28 http://soft-dev.org/
Datatype conversion: user types Datatype conversion: user types Python PHP o : PHPObject 20 / 28 http://soft-dev.org/
Datatype conversion: user types Datatype conversion: user types PyRoot PyObject PyInt PyFunc 20 / 28 http://soft-dev.org/
Recommend
More recommend