Nice Inline Syntax for DSLs
Knud Soerensen
4tuu4k002 at sneakemail.com
Tue Feb 20 06:07:05 PST 2007
On Fri, 16 Feb 2007 19:08:47 -0600, Tyler Knott wrote:
> Knud Soerensen wrote:
>> On Fri, 16 Feb 2007 16:35:46 -0700, Russell Lewis wrote:
>>
>> Well, we already have asm as a dsl.
>> Why not use a similar syntax like:
>>
>> dslname
>> {
>> ...
>> }
>>
>> We just need a way to tell the compiler which passer to use for dslname.
>
> I was thinking of a similar syntax as well, except it would look like this:
>
> # dsl(compilerFunc[, ...])
> # {
> # DSL GOES HERE
> # }
>
No, I meant something like.
compilerFunc draw[, ...]
{
... // parser code for the draw dsl.
};
and then it is used like
draw
{
moveto x,y;
circle(2.0);
...
}
the should be no need to repeat "compilerFunc[, ...]"
every time the dsl is needed.
More information about the Digitalmars-d
mailing list