caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xleroy@pauillac.inria.fr>
To: zdance@cs.cornell.edu (Stephan Zdancewic)
Cc: caml-list@pauillac.inria.fr
Subject: Re: Caml Parsing
Date: Wed, 18 Sep 1996 16:42:11 +0200 (MET DST)	[thread overview]
Message-ID: <199609181442.QAA02733@pauillac.inria.fr> (raw)
In-Reply-To: <199609171857.OAA04386@earth.cs.cornell.edu> from "Stephan Zdancewic" at Sep 17, 96 02:57:12 pm


> 	I'm trying to use the SML version of yacc to write a parser
> for Objective Caml, but I've run into problems because of some
> differences in SML-yacc and Caml-yacc.  More precisely, Caml-yacc
> allows you to specify precedence and associativity for non-terminals
> in the grammar, while SML-yacc will let you do this only for
> terminals.

If you're talking about the "%prec" directive, I'm very, very
surprised that SML-yacc does not have an equivalent feature (to
override the default precedence and associativities assigned to a
production). It's the standard trick for handling e.g. unary minus,
and also very useful to resolve reduce/reduce conflicts. You may want
to check with the author of SML-yacc (David Tarditi, I think).

> Alternatively, does there exist a specification
> of the OCaml grammar that doesn't rely on these precedence 
> levels/associativities?

There have been several attempts at writing recursive-descent parsers
for Caml, but none that will handle the whole O'Caml syntax. More
generally, it can be very hard to disambiguate a grammar by rewriting
the rules (as opposed to playing with precedences).

Regards,

- Xavier Leroy





      reply	other threads:[~1996-09-18 14:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-09-17 18:57 Stephan Zdancewic
1996-09-18 14:42 ` Xavier Leroy [this message]

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=199609181442.QAA02733@pauillac.inria.fr \
    --to=xleroy@pauillac.inria.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=zdance@cs.cornell.edu \
    /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;
as well as URLs for NNTP newsgroup(s).