All publications

Conference · 2009

J%: Integrating Domain Specific Languages with Java

Vassilios Karakoidas, Diomidis Spinellis

The first published description of J%: a Java extension in which each embedded domain-specific language is a compiler module, so that DSL code is syntax-checked and type-checked when the program is compiled.

Published in
Proceedings of 13th Panhellenic Conference on Informatics (PCI 2009), pp. 109--113, 2009
Citations
6 on Google Scholar, read 5 September 2026 — 20 of 30 by count
Cite as
KASP09
J%

The idea

Embedding SQL in Java through JDBC means handing the compiler a string. It cannot check the query, so syntax errors surface at run time as a driver exception — and if the test suite never executes that query, they do not surface at all. J% closes that gap generically: a DSL is embedded in a special class declaration, keeps its own syntax, and comes with a library used both at compile time and at run time.

What J% adds to Java

  • Compile-time syntax checking of the embedded DSL, with errors reported as compile errors.
  • Static typing across the boundary — Java variables appearing inside DSL code are type-checked.
  • Metaprogramming rather than translation. The DSL is not rewritten into Java; it generates code that drives the existing Java API for that domain — JDBC for SQL. This is the main difference from metaprogramming systems that transform the DSL into the host language.
  • One container for every DSL, so the grammar does not grow a custom extension per language.
  • Extensibility — a developer can add a DSL module through a defined API.

The prototype was a pre-processor translating J% source into ordinary Java, following the extensible compiler/interpreter pattern; the Java 1.5 grammar gains one new class form and a notation for external references.

Where it sits

The system is J%, developed at length in the thesis and in the 2015 journal paper.

Written from the paper itself — the PDF linked above, which this site hosts.