Tokenizing D at compile time?
dsimcha
dsimcha at yahoo.com
Thu Aug 25 18:08:29 PDT 2011
I'm working on a parallel array ops implementation for
std.parallel_algorithm. (For the latest work in progress see
https://github.com/dsimcha/parallel_algorithm/blob/master/parallel_algorithm.d
).
To make it (somewhat) pretty, I need to be able to tokenize a single
statement worth of D source code at compile time. Right now, the syntax
requires manual tokenization:
mixin(parallelArrayOp(
"lhs[]", "=", "op1[]", "*", "op2[]", "/", "op3[]"
));
where lhs, op1, op2, op3 are arrays.
I'd like it to be something like:
mixin(parallelArrayOp(
"lhs[] = op1[] * op2[] / op3[]"
));
Does anyone have/is there any easy way to write a compile-time D tokenizer?
More information about the Digitalmars-d
mailing list