Topic: Grammar simplification straw poll


Author: Michiel.Salters@cmg.nl (Michiel Salters)
Date: Tue, 4 Jun 2002 17:17:02 GMT
Raw View
I'm wondering if it's worth to simplify the grammar of
conditional statements slightly. Currently there's a special
production to generate declarations in if-statements:

condition:
  expression
  type-specifier-seq declarator = assignment-expression

This could be simplified, I think, by "reusing" the
decl-specifier-seq_opt init-declarator-lis_opt parts from
simple-declaration ( thus everything except the ; ).

This would allow

if ( T a(b) )
{
  // use a
}

just as the following currently is legal

for( T a(b) ;; )
{
  // use a
}

I coudn't see an obvious parsing problem, but that of course
doesn't prove anything.

[ This issue was brought up in a Dutch programming forum ]

Regards,
--
Michiel Salters

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]