|Implementing an "in" operator email@example.com (Ed Davis) (2002-11-13)|
|Re: Implementing an "in" operator firstname.lastname@example.org (Charles Bryant) (2002-11-20)|
|Re: Implementing an "in" operator email@example.com (Steve Siegfried) (2002-11-24)|
|Re: Implementing an "in" operator firstname.lastname@example.org (Ed Davis) (2002-11-26)|
|From:||"Ed Davis" <email@example.com>|
|Date:||26 Nov 2002 22:11:43 -0500|
|Posted-Date:||26 Nov 2002 22:11:43 EST|
"Steve Siegfried" <firstname.lastname@example.org> wrote in message news:02-11-127...
> Parsing this then becomes following the BNF (which I'm sure your
> professor gave you when he assigned the problem) and generating the IR
I graduated from college over 20 years ago. Pascal wasn't taught at
my university at that time. We used something called Algol-Z, which
was our (slightly) customized implementation of Wirth's Algol-W. It
did not have sets, or an "in" operator. And yes, I still have my
limited edition (a collectors item? <grin>), December 1976 copy of the
"Algol W Users Guide".
> Thus the whole trick behind implementing sets in a compiler is not in
> the operators, but in the internal representation of sets and
My language does not feature "sets".
int a, b, c, d, e
if (a in b,c..d,e)
I don't see how this fits with what you were saying. Of course I could
be wrong, and would be glad to be so, as your idea did appear simpler
than what I have come up with so far.
[Even though your language doesn't feature sets, your "in" operator is a
set membership test. "b,c..d,e" is a set, the "in" checks whether a is
in the set. -John]
Return to the
Search the comp.compilers archives again.