Adding Unicode operators to D
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Oct 26 19:43:52 PDT 2008
Bill Baxter wrote:
> On Mon, Oct 27, 2008 at 9:04 AM, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> wrote:
>
>>>> What's the precedence of your user-defined in-fix operator?
>>>>
>>>> --bb
>>> Yup, I realized this myself as well. Seemed like such a great idea when I
>>> only thought of it for three seconds. :p
>> An operator could always be defined to have the same precedent as an
>> existing operator, which it has to specify.
>
> Walter said in a previous post a few days ago when I suggested it that
> that would kill D's easy parsability.
> You say no? I'm no parser expert, so hard for me to say.
It can be done, but it's kinda involved. You define a grammar in which
all operators have the same precedence. Consequently you compile any
expression into a list of operands and operators. That makes the
language parsable without semanting info. Then the semantic stage
transforms the list into a tree. Cecil does that.
Andrei
More information about the Digitalmars-d-announce
mailing list