We have a requirement to create complex fixed length and variable length Strings. These strings might represent a customer profile, an order etc. Which JVM based programming lan
There are two types of DSL; external and embedded.
An external DSL is completely separate from your host language i.e. you write it outside the language but is usually used to generate code in the host language. For this approach, XText with XPand are probably the best tools as a simple grammar file generates a complete Eclipse based editor for the new DSL and you can use code templates in XPand to generate actual Java code. XTend and XPand are written in Java but this is incidental as they could be written in anything so long as you end up with Java code at the end of the process. The downside with this approach, is that for any reasonably complex problem the language will become quite complex and a lot of work will be required in the grammar and even more in the code generation templates. You can't use any host language features like expression evaluation so all of this needs rebuilding in your DSL if you need it. XText will shortly include XBase which is a partial language that will include expressions to help out here.
The other approach is an embedded DSL where high-level domain features are expressed in the host language either with higher-order constructs (like HOF's and monads) typically found in functional languages or through meta-programming facilities like macros (e.g. Lisp). Java has neither of these so is a bad choice for DSL work (or most other forms of abstract programming). Spring Roo offers a meta-programming type facility for java using generation so might be an option. Failing that, Scala is probably the most Java like JVM language that is popular and has the facilities that you need.
Embedded DSL's are usually much easier than external DSL's because you have the full support of the host language so my recommendation would be to try Scala.
Scala all the way! Scala is especially suitable for internal DSL (pls refer this).
Sounds like a problem for Apache Velocity templating engine. It is a Java library with a templating syntax or DSL if you will.
Groovy
http://docs.codehaus.org/display/GROOVY/Writing+Domain-Specific+Languages
I'll suggest jruby. I've done a few and it's always been pretty easy to get about what I want.
http://www.artima.com/rubycs/articles/ruby_as_dsl3.html
With Xtext (http://www.eclipse.org/Xtext/) you get a nice editor for free when specifying your DSL.