Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] stream parser jump-back
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Daniel de Rauglaudre <daniel.de_rauglaudre@i...>
Subject: Re: [Caml-list] stream parser jump-back
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