What is DReX?
DReX is a domain specific language for string transformations. Think of
examples like, “Replace every occurrence of the variable foo with
the variable bar,” or “Transform telephone numbers formatted as
(123) 456-7890 to 123-456-7890.”
- DReX is declarative. Transformations are modular, and small
easy-to-understand transformers can be combined into more complicated
- DReX is fast. There is a streaming one-pass algorithm to
evaluate well-typed DReX programs.
- DReX is based on strong theoretical foundations. The class of
functions expressible using DReX coincides with the class of
regular string transformations. There are several equivalent
characterizations, such as two-way finite state transducers, streaming
string transducers, and graph transformations in monadic second-order
logic. Regular string transformations are a robust class: they are
closed with respect to composition, regular look-ahead, input reversal,
- DReX permits algorithmic analysis. It is possible to
mechanically answer audit questions like, “Does this transformer ever
emit an unescaped backslash character?” Equivalence and
precondition computation are decidable, we are working on
practical programmer assistance tools for DReX.
It can be used either as a standalone application or as a Java library.