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
"nested" parsers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-12-03 (18:28)
From: Remi VANICAT <vanicat@l...>
Subject: Re: "nested" parsers
Georges Mariano <georges.mariano@inrets.fr> writes:

> Hello everyone,
> We have developed a parser for a language L using ocamllex
> and ocamlyacc , thus we have a L.mly 
> It appears that we can divide the language L in a few "sub"-languages.
> Let's say that  L3 <: L2 <: L1 = L   ('<:' included in )
> And we would like to have one entry point for each language
> in our parser.
> 	a) is it possible (i.e  with ocamlyacc) ?
> 	(with one .mly, with several ??)
> 	b) how to do that ? (it's not very clear for us ;-)
> 	(pointers to specifica documentation or examples are
> 	welcome...)

i am not sure of what you want, but you have this in the

%start symbol ...  symbol 
          Declare the given symbols as entry points for the
          grammar. For each entry point, a parsing function with the
          same name is defined in the output module. Non-terminals
          that are not declared as entry points have no such parsing
          function. Start symbols must be given a type with the %type
          directive below.

so for each sub-languages you mai put the corresponding symbol in the
start close