Re: Iterator

"Randall Hyde" <rhydemscs@aol.com>
27 May 2002 01:16:36 -0400

          From comp.compilers

Related articles
Iterator takusi@manjiro.net (2002-05-23)
Re: Iterator neelk@alum.mit.edu (2002-05-27)
Re: Iterator rhydemscs@aol.com (Randall Hyde) (2002-05-27)
Re: Iterator joachim_d@gmx.de (Joachim Durchholz) (2002-05-27)
Re: Iterator haberg@matematik.su.se (Hans Aberg) (2002-05-27)
Re: Iterator bobduff@shell01.TheWorld.com (Robert A Duff) (2002-05-31)
| List of all articles for this month |
From: "Randall Hyde" <rhydemscs@aol.com>
Newsgroups: comp.compilers
Date: 27 May 2002 01:16:36 -0400
Organization: Prodigy Internet http://www.prodigy.com
References: 02-05-125
Keywords: design
Posted-Date: 27 May 2002 01:16:36 EDT

Takuya Murata wrote
>Now, I'm making a compiler. I want to support a loop feature as
>iterators like Sather.
>
>http://www.icsi.berkeley.edu/~sather/Documentation/LanguageDescription/webm
aker/DescriptionX2Eiterators-chapte-1.html#HEADING1-5
>
>The problem is as if two stacks exists concurrently. I couldn't find a
>compiler construction book about how to implement iterator mechanism.
>Anyone suggestion?


I'm not familiar with iterators in Sather, but if they're like the
ones in CLU then you don't need two stacks, you can use "resume
frames" to accomplish this (see "Programming Language Concepts by
Ghezzi & Jazayeri). I've implemented iterators this way in the HLA
(High Level Assembler) compiler and it was quite efficient.


If your semantics really do require two stacks, then the language
construct you're describing is probably a "generator" and I'd look at
the implementation of generators in the Icon language for some
additional details.


Randy Hyde


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.