From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA18932; Tue, 10 Aug 2004 12:03:17 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA18884 for ; Tue, 10 Aug 2004 12:03:16 +0200 (MET DST) Received: from smtp.cegetel.net (mf01.sitadelle.com [212.94.174.78]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i7AA3FmL026843 for ; Tue, 10 Aug 2004 12:03:15 +0200 Received: from warp (unknown [80.125.123.36]) by smtp.cegetel.net (Postfix) with SMTP id 56563378F0; Tue, 10 Aug 2004 12:03:13 +0200 (CEST) Message-ID: <000901c47ec1$22f1db00$ef01a8c0@warp> From: "Nicolas Cannasse" To: , "caml" References: <200408101152.17727.micha-1@fantasymail.de> Subject: Re: [Caml-list] stream parser problem/question Date: Tue, 10 Aug 2004 12:02:22 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Miltered: at nez-perce with ID 41189D63.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; cannasse:01 warplayer:01 caml-list:01 python:01 cannasse:01 tokens:01 ocaml:01 nicolas:01 nicolas:01 token:01 token:01 parser:02 parser:02 tree:02 tree:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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