help-bison
[Top][All Lists]
Advanced

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

Re: Conditional execution rules


From: Hans Aberg
Subject: Re: Conditional execution rules
Date: Mon, 6 Aug 2001 11:25:16 +0200

At 02:32 +1000 2001/08/06, James Buchanan wrote:
>I have always tried to figure out how to make a type of conditional control
>statement.

I find it confusing to read your post, because it is not clear to me
exactly what you want:

The Bison manual section 5.2 has examples of how to do "if .. then ... else
..." statements. This includes how to handle to so called "dangling else",
which occurs if one also admits "if .. then ..." without the "else" part
(as in C/C++).

The C++ standard, which is called ISO+IEC+14882-1998 and can be bought from
ANSI for $18 (make sure to get the right one, as the one by ISO costs
$250), has a grammar in it. The part containing the "if" clause looks like:
  selection-statement:
    `if' ( condition ) statement
    `if' ( condition ) statement `else' statement
    `switch' ( condition ) statement
(or rather, it is typeset, so I had to put in `...' by hand).

I use to look into this C++ grammar in order to get ideas in constructing
my won Bison grammars.

  Hans Aberg





reply via email to

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