Re: Iterator

"Randall Hyde" <>
27 May 2002 01:16:36 -0400

          From comp.compilers

Related articles
Iterator (2002-05-23)
Re: Iterator (2002-05-27)
Re: Iterator (Randall Hyde) (2002-05-27)
Re: Iterator (Joachim Durchholz) (2002-05-27)
Re: Iterator (Hans Aberg) (2002-05-27)
Re: Iterator (Robert A Duff) (2002-05-31)
| List of all articles for this month |

From: "Randall Hyde" <>
Newsgroups: comp.compilers
Date: 27 May 2002 01:16:36 -0400
Organization: Prodigy Internet
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.
>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.