Related articles |
---|
Implementing an "in" operator ed_davis2@yahoo.com (Ed Davis) (2002-11-13) |
Re: Implementing an "in" operator n502640813.ch@chch.demon.co.uk (Charles Bryant) (2002-11-20) |
Re: Implementing an "in" operator sos@zjod.net (Steve Siegfried) (2002-11-24) |
Re: Implementing an "in" operator ed_davis2@yahoo.com (Ed Davis) (2002-11-26) |
From: | "Ed Davis" <ed_davis2@yahoo.com> |
Newsgroups: | comp.compilers |
Date: | 26 Nov 2002 22:11:43 -0500 |
Organization: | http://groups.google.com/ |
References: | 02-11-079 02-11-127 |
Keywords: | design, comment |
Posted-Date: | 26 Nov 2002 22:11:43 EST |
"Steve Siegfried" <sos@zjod.net> 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
> set-constants.
My language does not feature "sets".
Given:
int a, b, c, d, e
if (a in b,c..d,e)
stmt_seq
endif
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
comp.compilers page.
Search the
comp.compilers archives again.