[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: for loops in C style
From: |
Ilyes Gouta |
Subject: |
Re: for loops in C style |
Date: |
Fri, 29 Feb 2008 10:23:20 +0100 |
Hi!
Thanks for your help.
If I setup a new fexpr (and a new fassignment) that would accept
nothing or expression, i.e:
fexpr:
| expr;
for_stmt:
for (fassignment; fexpr; fassignment) block
How can I define an action that would be triggered only for the empty
expressions? (I have to differentiate between the two cases since they
won't have a common action)
The only meaningful way, I found on the net to handle this, is this one:
http://www.cs.uaf.edu/2007/fall/cs631/Cyacc.y
Basically what it's done is enumerating all the possibilities for the
construction of the for loop. Is it the only way do things clearly and
properly?
Best regards,
Ilyes Gouta.
On Thu, Feb 28, 2008 at 9:59 PM, Hans Aberg <address@hidden> wrote:
> On 28 Feb 2008, at 15:16, Ilyes Gouta wrote:
>
> > I'm writing a small grammar for a very simplified C language. My goal
> > is to produce an AST once a script file is parsed by the flex/bison
> > tools. I got almost everything working nicely, except for the C style
> > for loops.
> ...
>
> > How one would modify the grammar to take into
> > account such a scenario?
> >
> > Any ideas?
>
> There is a Yaccable grammar of C++ - you might check that out
> http://www.parashift.com/c++-faq-lite/compiler-
> dependencies.html#faq-38.11
>
> Hans Aberg
>
>
>
- for loops in C style, Ilyes Gouta, 2008/02/28
- Re: for loops in C style, Bob Rossi, 2008/02/28
- Re: for loops in C style, Hans Aberg, 2008/02/28
- Re: for loops in C style,
Ilyes Gouta <=
- Re: for loops in C style, Ilyes Gouta, 2008/02/29
- Re: for loops in C style, Laurence Finston, 2008/02/29
- Re: for loops in C style, Ilyes Gouta, 2008/02/29
- Re: for loops in C style, Laurence Finston, 2008/02/29
- Re: for loops in C style, Ilyes Gouta, 2008/02/29
- Re: for loops in C style, lfinsto1, 2008/02/29
- Re: for loops in C style, Evan Lavelle, 2008/02/29