On 1 Oct 2006, at 11:40, M. Edward (Ed) Borasky wrote:

> Martin Coxall wrote:
>> In any case, there's a question about about to what extent you  
>> *should*
>> host DSLs internally. It's my feeling that if you want to inline a  
>> DSL
>> in your code, make sure that language is still syntactically
>> recognizably a Ruby. Ruby on Rails is a classic example.
>
> The problem I have with the two best-known Ruby DSLs, Rails and  
> Rake, is
> the somewhat non-intuitive mix of words that don't begin with colons,
> and symbols, which do.

True, but at least it's recognizably, syntactically, Ruby.  I'm not  
sure there's a way round the colon issue, you just have to live with it.

> And Rails requires YAML in some places that are
> jarring to the reader. Why is the database connection description file
> in YAML and not in "a Ruby"?
>>

I guess, because the feeling is that YAML is more recognizable as  
user-editable config than a Ruby script, which would tend to frighten  
some people off?

>> Once you cross that line where your DSL is no longer 'a Ruby',  
>> create a
>> grammar for it and knock together a parser for it in Racc.
>
> Ah, but once you cross that boundary and start building an external  
> DSL,
> what does Ruby have to offer that other compiler-compiler tools don't
> have?

Easy integration with the rest of your Ruby codebase, mainly.

> Mind you, I haven't yet tried to build anything with Racc, so I
> don't know if it's a significant improvement on Yacc, Bison or the  
> Java
> thingie -- is it Antlr??

Well, C is not a great language for writing parsers in, and in my  
experience neither is Java. The best language I've seen for writing  
language parsers is Haskell. Though Racc does a competent job. I  
don't think it's antlr, though.

Martin