caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: "Robert W." <slrn_robert@yahoo.de>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] yacc question
Date: Mon, 05 Dec 2005 03:46:22 +1100	[thread overview]
Message-ID: <1133714782.11050.42.camel@rosella> (raw)
In-Reply-To: <20051204150339.GA10618@waltraud.manson.mm>

On Sun, 2005-12-04 at 16:03 +0100, Robert W. wrote:

> ocamlyacc parses longest match by default.
> Your rule for atoms seem to complex or you lexer isn't able to extract
> the token for atoms correctly from the line.

When I parse atoms only, it all works fine. The problem
is that if the user specifies a production like:

#statement select expr within statement ;

then if I parse 'expr' with 'atom' this will not be allowed:

select 1 + 2 within print x;

because '1 + 2' isn't an atom. The user would be forced to write:

select (1 + 2) within print x;

But if I parse with 'expr' instead of atom,
the parse fails when it hits the unknown symbol 'within'.

> >   | expr token_not_allowed_in_expressions
> > 
> > and then 'put back' the trailing token into the buffer.
> > Is there another way?
> > 
> This shouldn't be necessary, normally you can redesign your parser
> rules to avoid this.

The problem is I'm trying to add 'on the fly' user 
defined grammar productions -- so the 'grammar' is 
extensible. This will be done by recursive descent,
but hooked inside, and hooking, the existing ocamlyacc
grammar.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2005-12-04 16:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-04 14:15 skaller
2005-12-04 15:03 ` [Caml-list] " Robert W.
2005-12-04 16:46   ` skaller [this message]
2005-12-04 15:25 ` Brian Hurt
2005-12-04 16:37   ` 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=1133714782.11050.42.camel@rosella \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@yquem.inria.fr \
    --cc=slrn_robert@yahoo.de \
    /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).