caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Robert W." <slrn_robert@yahoo.de>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] yacc question
Date: Sun, 4 Dec 2005 16:03:39 +0100	[thread overview]
Message-ID: <20051204150339.GA10618@waltraud.manson.mm> (raw)
In-Reply-To: <1133705740.11050.14.camel@rosella>

On Mon, Dec 05, 2005 at 01:15:40AM +1100, skaller wrote:
> I have the 'usual' kind of parser for expressions, with two
> nonterminals 'expr' and 'atom', the latter including ( expr ) 
> and INTEGER of course.
> 
> When I have input like
> 
> 1;
> 1 + 2 ;
> (1 + 2) ;
> 
> none of the case parse as expressions, the first and
> last do parse as atoms (leaving the ; in the buffer).
> 
> What I want is to parse the longest possible match.
> The only way I can think of doing this is:
> 

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.

>   | 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.

-- 

	Robert...


  reply	other threads:[~2005-12-04 15:04 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 ` Robert W. [this message]
2005-12-04 16:46   ` [Caml-list] " skaller
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=20051204150339.GA10618@waltraud.manson.mm \
    --to=slrn_robert@yahoo.de \
    --cc=caml-list@yquem.inria.fr \
    /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).