DSL debugging DSL debugging We normally assume that compilers are perfect DSL compilers are probably imperfect Are errors due to the user or the compiler? 22 / 59 http://soft-dev.org/
Static error reporting Static error reporting 23 / 59 http://soft-dev.org/
Run-time error reporting Run-time error reporting Src infos are a triple: ( fi le I D, char o ff set, char span) Threaded throughout the compiler: 1 Each token/lexeme has one src info 2 Each parse tree has more than one src info 3 Each bytecode has more than one src info 24 / 59 http://soft-dev.org/
Fun with names Fun with names Dynamic scoping is dangerous. 25 / 59 http://soft-dev.org/
Fun with names Fun with names Dynamic scoping is dangerous. Can it be made safe? 25 / 59 http://soft-dev.org/
Meta-levels Meta-levels Three relative meta-levels describe everything: Meta-level Description 26 / 59 http://soft-dev.org/
Meta-levels Meta-levels Three relative meta-levels describe everything: Meta-level Description 0 Normal compilation 26 / 59 http://soft-dev.org/
Meta-levels Meta-levels Three relative meta-levels describe everything: Meta-level Description Splicing ( $<...> ) -1 0 Normal compilation 26 / 59 http://soft-dev.org/
Meta-levels Meta-levels Three relative meta-levels describe everything: Meta-level Description Splicing ( $<...> ) -1 0 Normal compilation Quasi-quoting ( [| ...|] ) +1 26 / 59 http://soft-dev.org/
What works well? What works well? 1 src infos make debugging possible. 27 / 59 http://soft-dev.org/
What works well? What works well? 1 src infos make debugging possible. 2 rename enables building huge, name-safe trees. 27 / 59 http://soft-dev.org/
What works well? What works well? 1 src infos make debugging possible. 2 rename enables building huge, name-safe trees. 3 DSL layers work and are useful. 27 / 59 http://soft-dev.org/
What works well? What works well? 1 src infos make debugging possible. 2 rename enables building huge, name-safe trees. 3 DSL layers work and are useful. 4 The compiler is surprisingly simple 27 / 59 http://soft-dev.org/
What works well? What works well? 1 src infos make debugging possible. 2 rename enables building huge, name-safe trees. 3 DSL layers work and are useful. 4 The compiler is surprisingly simple (though calculations with names make my head hurt). 27 / 59 http://soft-dev.org/
What doesn’t work? What doesn’t work? 1 Delimiters are far too ugly for repeated use. 28 / 59 http://soft-dev.org/
What doesn’t work? What doesn’t work? 1 Delimiters are far too ugly for repeated use. 2 Macro evaluation is top-to-bottom. DSLs can’t validate e.g.: $<<SQL>><SELECT c1 FROM t> $<<SQL>><CREATE TABLE t ( c2 STR )> 28 / 59 http://soft-dev.org/
What doesn’t work? What doesn’t work? 1 Delimiters are far too ugly for repeated use. 2 Macro evaluation is top-to-bottom. DSLs can’t validate e.g.: $<<SQL>><SELECT c1 FROM t> $<<SQL>><CREATE TABLE t ( c2 STR )> 3 Syntax composition is nearly impossible. 28 / 59 http://soft-dev.org/
What doesn’t work? What doesn’t work? 1 Delimiters are far too ugly for repeated use. 2 Macro evaluation is top-to-bottom. DSLs can’t validate e.g.: $<<SQL>><SELECT c1 FROM t> $<<SQL>><CREATE TABLE t ( c2 STR )> 3 Syntax composition is nearly impossible. 4 Performance for mildly complex DSLs is poor. 28 / 59 http://soft-dev.org/
Where do we go from here? 29 / 59 http://soft-dev.org/
Part III A different way 30 / 59 http://soft-dev.org/
Language composition: two levels of challenge Language composition: two levels of challenge 31 / 59 http://soft-dev.org/
Language composition: two levels of challenge Language composition: two levels of challenge Tooling 31 / 59 http://soft-dev.org/
Language composition: two levels of challenge Language composition: two levels of challenge Tooling Language friction 31 / 59 http://soft-dev.org/
Tooling challenges Tooling challenges 32 / 59 http://soft-dev.org/
Tooling challenges Tooling challenges Python PyHyp PHP 32 / 59 http://soft-dev.org/
Tooling challenges Tooling challenges syntax Python runtime syntax PyHyp runtime syntax PHP runtime 32 / 59 http://soft-dev.org/
Tooling challenges Tooling challenges syntax Language boxes Python runtime syntax PyHyp runtime syntax PHP runtime 32 / 59 http://soft-dev.org/
Tooling challenges Tooling challenges syntax Language boxes Python runtime syntax PyHyp runtime syntax PHP Composed runtime meta-tracing VMs 32 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... PL Y <program> for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... Parser PL Y <program> for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... Parser PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... LR PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... U | ... n | ... d e func ::= ... f LR i n e PL Y d <program> Parse Tree for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... Generalised PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... A term::= ... m | ... b | ... i g func ::= ... u Generalised o u s PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... | ... func ::= ... PEG PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
Syntax composition Syntax composition PL X <grammar> expr::= ... term::= ... | ... S | ... h func ::= ... a d PEG o w s PL Y <program> Parse Tree for (j : js) { doStuff(); } . . . 33 / 59 http://soft-dev.org/
The only choice? The only choice? 34 / 59 http://soft-dev.org/
The only choice? The only choice? SDE 34 / 59 http://soft-dev.org/
The challenge The challenge Challenge: SDE’s power + a text editor feel? 35 / 59 http://soft-dev.org/
Eco demo Eco demo 36 / 59 http://soft-dev.org/
Runtime composition Runtime composition 37 / 59 http://soft-dev.org/
Runtime composition Runtime composition PL X PL Y Interpreter Interpreter C/C++ 37 / 59 http://soft-dev.org/
Runtime composition Runtime composition PL X PL Y Too slow Interpreter Interpreter C/C++ 37 / 59 http://soft-dev.org/
Runtime composition Runtime composition JIT Compiler JIT Compiler PL X PL Y Interpreter Interpreter C/C++ 37 / 59 http://soft-dev.org/
Runtime composition Runtime composition JIT Compiler JIT Compiler PL X PL Y Too much engineering Interpreter Interpreter C/C++ 37 / 59 http://soft-dev.org/
Runtime composition Runtime composition PL X PL Y Interpreter Interpreter JVM/CLR JIT Compiler 37 / 59 http://soft-dev.org/
Runtime composition Runtime composition PL X PL Y Semantic mismatch Interpreter Interpreter JVM/CLR JIT Compiler 37 / 59 http://soft-dev.org/
Runtime composition Runtime composition 37 / 59 http://soft-dev.org/
Runtime composition Runtime composition Meta-tracing PL X PL Y PL Z RPython Interpreters Interpreter Tracing JIT Glue 37 / 59 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter 38 / 59 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter translator RPython 38 / 59 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter translator RPython Optimised JIT Interpreter 38 / 59 http://soft-dev.org/
Meta-tracing translation with RPython Meta-tracing translation with RPython Interpreter translator RPython Optimised JIT Interpreter 38 / 59 http://soft-dev.org/
Recommend
More recommend