Nice Inline Syntax for DSLs
Leandro Lucarella
llucarella at integratech.com.ar
Mon Feb 19 05:25:46 PST 2007
Tyler Knott escribió:
> 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
> # }
>
> With three restrictions:
> 1. All curly braces within the DSL must be balanced.
> 2. compilerFunc must be evaluable at compile time.
> 3. compilerFunc must use the signature char[] function(char[][, ...]).
Maybe
# dsl(compilerFunc[, ...]):
# DSL GOES HERE TO THE EOF
Because you don't impose any restrictions on the DSL syntax (removes the
restriction 1). The only drawback I see in this, is it has to be some
kind of special key where only ':' block syntax shoul be used, and where
no other block can appear before the end of file.
--
Leandro Lucarella
Integratech S.A.
4571-5252
More information about the Digitalmars-d
mailing list