help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stopping as soon as a valid symbol is read


From: Ludovic Courtès
Subject: Re: Stopping as soon as a valid symbol is read
Date: Mon, 25 Jul 2011 16:22:40 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Hi Hans,

Hans Aberg <address@hidden> skribis:

> On 25 Jul 2011, at 10:52, Ludovic Courtès wrote:
>
>> I’m trying to parse a C expression from an input stream.  I’d like the
>> parser to stop as soon as a valid expression is read (or an error is
>> encountered).
>> 
>> However, the default behavior is to stop whenever a valid expression
>> /followed by the end-of-file marker/ is encountered.  Thus, if the input
>> stream contains a sequence of 2 or more expressions, the parser will
>> report an error because it’s expecting $end after the first expression.
>> 
>> Any idea how to achieve what I want?
>
> It may be the push parser you are looking for. (See the Bison manual, sec. 
> 3.7.11.)

Indeed, thanks!

However, with a pure API, I don’t see how to get yyresult back from user
code?  The code snippet in the manual pushes tokens but never asks for
the result.

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]