Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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,
then
> processing the tree and putting the output into a queue. Then I iterate
over
> 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
parser
> 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
(with
> Stream.from) of my parse tree (because of the tree-stucture, I get
confused
> 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 ?

Regards,
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