Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Alessandro Baretta <a.baretta@barettadeit.com>
To: skaller <skaller@users.sourceforge.net>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Another nasty with ocamlyacc: magic needed?
Date: Mon, 05 Dec 2005 08:08:12 +0100	[thread overview]
Message-ID: <4393E75C.9000608@barettadeit.com> (raw)
In-Reply-To: <1133760933.8957.125.camel@rosella>

skaller wrote:
> I have what looks like a showstopper (meaning black magic
> seems to be the only solution).
> 
> I need two *distinct* parsers which use the same set
> of tokens. This is currently impossible AFAICS without
> magic (distinct -- in a different module entirely)


Let's not overstate the problem. Yacc is an imperfect tool. Everybody who used 
it knows this, but it is usually flexible enough that you can--eventually--get 
it to do what you have in mind. I would suggest that you consider a couple of 
tools which might help get out of this /impasse/. Firstly, remember that can 
define as many parser entry points as your heat desires. Each entry point is 
virtually a distinct parser, except that the token type is shared and the 
non-terminal namespace is also shared, which might be a bane or a boon depending 
on whether the two grammars you wish to impolement share some productions or 
not. Secondly, after compiling the automaton with ocamlyacc, you can always 
delete and regenerate the interface with ocamlc -i. My Makefile generator for 
ocaml, builder, actually handles this pretty nicely, allowing the parser to 
export anything you put in the header.

Alex



-- 
*********************************************************************
http://www.barettadeit.com/
Baretta DE&IT
A division of Baretta SRL

tel. +39 02 370 111 55
fax. +39 02 370 111 54

Our technology:

The Application System/Xcaml (AS/Xcaml)
<http://www.asxcaml.org/>

The FreerP Project
<http://www.freerp.org/>


  parent reply	other threads:[~2005-12-05  7:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-05  5:35 skaller
2005-12-05  6:25 ` [Caml-list] " Geoff Wozniak
2005-12-05  7:08 ` Alessandro Baretta [this message]
2005-12-05  8:52   ` skaller
2005-12-05  9:05     ` Alessandro Baretta
2005-12-06  0:41 ` skaller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4393E75C.9000608@barettadeit.com \
    --to=a.baretta@barettadeit.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=skaller@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox