Create mixins from a list of strings

Casper Færgemand" <shorttail at hotmail.com> Casper Færgemand" <shorttail at hotmail.com>
Sat Jan 11 05:34:17 PST 2014


On Saturday, 11 January 2014 at 09:17:34 UTC, Philippe Sigaud 
wrote:
>         case "Gramm.Expr":
>             return foo(t);
>         case "Gramm.FunctionCall":
>             return foo(t);
>         case "Gramm.Declaration":
>             return foo(t);
>         default:
>             throw new Exception("...");

I can't do this since there will be multiple rules with the same 
name that require different treatment. The reason I want to use 
semantic actions is that I don't want to push an already heavy 
grammar into double or triple size just to name specific rules in 
a certain way. Semantic actions take up very little space and fit 
nicely into the syntax.


> or do it with a template, holding function names as aliases:
>
> alias actor = dispatcher!(foo, bar, baz);

I have no idea what you mean. :D


More information about the Digitalmars-d-learn mailing list