D2X Looks to Boost Domain-Specific Language Use by Making Debugging Accessible to All
The "detox" framework sits between a high-performance domain-specific language and standard debuggers, solving a big problem in their use.
A pair of computer scientists at the Massachusetts Institute of Technology (MIT) Computer Science and Artificial Intelligence Laboratory (CSAIL) claim to have made a breakthrough in one of the biggest problems for the use of domain-specific languages (DSLs): debugging them.
The idea behind a domain-specific language (DSL) is simple: the majority of programming languages are generalized, allowing you the flexibility to write a program that does your taxes, another that plays a game, and yet another that controls a robot. Being a Jack of all trades, though, means being a master of none β and creating a new language dedicated to a single class of problems can unlock major performance and efficiency gains.
"On the one hand, domain-specific languages are our only hope for serious improvements in computing efficiency in the modern era," explains Adrian Sampson, associated professor from Cornell University who was not personally involved in the research. "However, making a new debugger for a new language from scratch is hard, and the absence of a debugger is a rational reason that a programmer might reject a 'better' language in favor of a 'worse' one."
"As I see it, there's a huge number of people who support traditional languages β thousands of programmers building tools for C, C++, or Java," explains co-author Saman Amarasinghe of the problem the researchers sought to solve. "On the other hand, If I am building a simple DSL, I don't have thousands of programmers to provide all that support. [But now] the small guys can get all the things the others get, including debuggers and eventually editors and profilers β the same benefits that come with traditional languages. And you can get that without having teams of engineers writing all kinds of complicated code."
The solution: D2X, pronounced "detox," an infrastructure designed to provide an interface which can sit between a DSL and traditional debuggers, like gdb
, providing full access to the same tools a developer working on a more generalized language like C++ would enjoy. While the debuggers don't need modification, though, the DSL compiler does β but the team says that its exemplar project, the graph language GraphIt, needed only 1.4 per cent of its code base changing to include D2X support.
The researchers have also added D2X support to BuildIt, its meta-programming framework which is designed specifically for the creation of DSLs β allowing any DSL created using BuildIt to support standard debuggers without any manual modifications. "[D2X] provides rich debugging information that can be easily extended to fit the needs of upcoming DSLs with ease," the pair concludes. "D2X thus greatly increases productivity for not only the end-user but also the [DSL] designers."
The team has made the D2X source code available under the permissive MIT license via the Zenodo database, while the paper describing the project β presented at the IEEE/ACM International Symposium on Code Generation and Optimization 2023 (CGO '23) in Canada earlier this year β is available as an open-access PDF download.