English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] stream parser problem/question
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-08-10 (10:03)
From: Nicolas Cannasse <warplayer@f...>
Subject: Re: [Caml-list] stream parser problem/question
> Hi,
> I'm using ocamllex/yacc to translate a little language into a parse-tree,
> processing the tree and putting the output into a queue. Then I iterate
> the queue, generating a new one and so on until finished.
> My question is, instead of outputing the processed parse-tree into a
queue, is
> ist better/more elegant to generate a stream and then using a stream
> to process that stream and eventual generating a new stream,... until
> finished?
> Are stream parsers useful for my purpose? Are there penalties using them?
> Another slight issue is, that I don't see how to generate a token stream
> Stream.from) of my parse tree (because of the tree-stucture, I get
> how to get the right next token); maybe someone can give me a hint?

It is actually not easy to generate a stream of tokens for a tree, since you
have to simulate the call stack by yourself. In languages such as Python,
the yield keyword is very useful for this. Is there any plans to get such
thing in OCaml and is there any implementation notes available ?

Nicolas Cannasse

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners