[kelbt-users] [feature proposal] named symbols in rules
Adrian Thurston
thurston at complang.org
Fri Jan 23 01:11:57 UTC 2009
That is a good feature. In the Colm language there are named items in
patterns and I used a colon name something (Name:Type). That wouldn't
work here though since colon is used after the lhs name.
-Adrian
Elijah Epifanov wrote:
> This has been done already in lemon and proved to reduce amount of
> errors and coding time (especially when refactoring).
>
> This
> %%
> E: E tok_plus F commit try {
> $$->res = $1->res + $3->res;
> printf( "E(%f) = E(%f) tok_plus F(%f);\n", $$->res, $1->res, $3->res);
> };
> %%
>
> would be prettier written like this
> %%
> E: E(A) tok_plus F(B) commit try {
> $$->res = $A->res + $B->res;
> printf( "E(%f) = E(%f) tok_plus F(%f);\n", $$->res, $A->res, $B->res);
> };
> %%
>
> In lemon, however a target symbol has it's own alias too, which
> doesn't really make sense because it's unique in a given rule.
>
> _______________________________________________
> kelbt-users mailing list
> kelbt-users at complang.org
> http://www.complang.org/mailman/listinfo/kelbt-users
More information about the kelbt-users
mailing list