help-bison
[Top][All Lists]
Advanced

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

Re: Forcing multiple parse stacks to 'reduce'


From: Frank Heckenbach
Subject: Re: Forcing multiple parse stacks to 'reduce'
Date: Mon, 28 Feb 2005 22:08:07 +0100
User-agent: semail 20050101

Derek M Jones wrote:

> >>I have written a parser for C that processes
> >>a single statement or declaration at a time.
> >>So after each statement/declaration yyparse
> >>returns.
> >
> >Bison is clearly not built to handle such applications. The normal thing is
> >to handle the whole language in one go. (How do you handle environments,
> >like "{...}" statement-by-statement?)
> 
> I don't see why not.  Bison is built to handle grammars.

Because bison expects the lexer to return a EOF (or perhaps more
precisely, end-of-grammar) token to signal the end of input (of one
"grammar", i.e. one statement in your case). So you'd have to supply
this token, which is exactly the problem you're having ...

Frank

-- 
Frank Heckenbach, address@hidden
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)




reply via email to

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