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 IAA12827; Mon, 5 Aug 2002 08:40:45 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA12634 for ; Mon, 5 Aug 2002 08:40:45 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g756eiD10479 for ; Mon, 5 Aug 2002 08:40:44 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id IAA30649 for caml-list@inria.fr; Mon, 5 Aug 2002 08:40:39 +0200 Date: Mon, 5 Aug 2002 08:40:39 +0200 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] stream parser jump-back Message-ID: <20020805084039.F29829@verdot.inria.fr> References: <20020805015938.C17263@max.home> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020805015938.C17263@max.home>; from max630@mail.ru on Mon, Aug 05, 2002 at 01:59:38AM +0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Mon, Aug 05, 2002 at 01:59:38AM +0700, Max Kirillov wrote: > Is it possible in a stream parser to parse again already > accepted token. No. > I'd like to make this in camlp: > A(B).c --> let module M = A(B) in M.c > To do that, i write (scematically): > expr: > [[ m = module_expr; "."; e = expr -> ... ]] This is complicated, because "module_expr" have several rules starting with rules already starting "expr". This extension will introduce syntax errors in many normal cases. > So, can I write something like: > [[ TRY (m = module_expr); "."; ... and so on, do get parsing > failure insted of error, and push the successful head of failed > structute back into a stream, to parse it again (as an expr > now)? You can add a grammar entry defined by a parser. There are examples of that in the "normal" syntax (pa_o.ml, in Camlp4, subdirectory etc). See entries "test_ctyp_minusgreater", "test_label_eq", "test_typevar_list_dot". But I consider they are "hacks" to make some situation work. -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- 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