WG211/M10Siek
Composing DSLs by Jeremy Siek
Domain-specific languages offer domain-appropriate syntax that lowers
the learning curve for domain experts. However, large software
applications often use of several domain-specific languages and suffer
from the language interoperability problem. The alternative approach
of embedding domain-specific languages in a general purpose language
solves the interoperability problem, but compromises the
domain-appropriate syntax.
In this talk I propose an approach to parsing a program that consists
of intertwined uses of multiple DSLs. This parsing problem is
difficult because we do not assume that the DSLs have the same author,
and as a result, the composition of their grammars is likely to be
highly ambiguous. However, we observe that DSLs usually introduce new,
unique types, and if those types are incorporated into each DSL's
grammar rules, then most of the ambiguity goes away. (Our approach is
inspired by the analogous notion of selection restriction in natural
language processing.) We have explored type-based disambiguation
within the context of an island parsing algorithm, a particular style
of chart parser, and I present experimental results demonstrating that
parse times are resilient to the number of DSLs being composed.