help-bison
[Top][All Lists]
Advanced

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

Re: how to discard redundant ';'


From: sandori
Subject: Re: how to discard redundant ';'
Date: Tue, 19 Jan 2010 08:32:18 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Mon, Jan 18, 2010 at 04:21:45PM -0600, Michael Chen wrote:
> My grammar statement ends with a ';'. Even myself sometimes press the
> ';' multiple times. So definitely I need a way to silently ignore all
> redundant ';'. How to do it? Thanks.

Multiple ';'-s can be regarded as empty statements, so if your grammar
is:

stmtlist: /* empty */
        | stmtlist ';'
        | stmtlist stmt ';'
        ;

stmt: ....

then this will do it. I guess whitespace is insignificant in your
language, so the lexer eats it up, this way

;   ; ; ;;; will be all empty statements with the above grammar snippet.

regards

Istvan




reply via email to

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