Domain Specific Languages

Jaxon has been doing a lot of work in regulated industries like Financial Services, Healthcare, and Insurance. Places where AI’s decisions have profound implications. Something we’ve learned while working with the Department of Defense is how to incorporate a Domain Specific Language (DSL) into complex AI systems to bring trust into the equation.

A DSL allows developers to create and customize their own languages for specific domains. A DSL can capture the programmer’s intent at a higher level of abstraction and provide many software engineering benefits such as clarity, portability, maintainability, and testability. DSLs also provide the compiler with more opportunities for higher performance and can encode expert knowledge of domain-specific transformations. This results in a better view of the computation performed without heroic analysis and fewer low-level decisions by the programmer that have to be undone.

There are different ways to implement meta-programming with a DSL, such as:

  • Embedded DSL: A DSL that is embedded in a host language, using its syntax and features. For example, SQL is an embedded DSL for querying relational databases in many languages.
  • External DSL: A DSL that is defined outside of a host language, using its own syntax and features. For example, HTML is an external DSL for describing web pages.
  • Hybrid DSL: A DSL that combines elements of both embedded and external DSLs. For example, Ruby on Rails is a hybrid DSL that uses Ruby as the host language and provides external DSLs for web development tasks.

A meta-modeling tool is a software tool that helps in the design and implementation of a DSL. A great example is Lark, a modern parsing library for Python that can parse any context-free grammar. It can be used to create a DSL by defining grammar for the language using its advanced grammar language. Once the grammar is defined, a compiler parses the input written in the DSL and constructs a parse tree that can be used to interpret the language.

Meta-programming

Ultimately, we want DSLs customized for different domains (verticals) that we’re targeting. A meta-programming system (MPS) is a key part of using the DSLs as a technique of writing programs that can manipulate other programs or themselves. MPS allows developers to design their own extensible DSLs and use them to build end-user applications. 

Learn how Jaxon is using DSLs at www.jaxon.ai/dsail