Mail Archives: djgpp/1999/07/10/07:45:32
Martin Str|mberg wrote:
> Campbell, Rolf [SKY:1U32:EXCH] (cp1v45 AT americasm01 DOT nt DOT com) wrote:
> : struct a {int a; int b;};
> : struct b {int a; int b;};
> :
> : int main()
> : {
> : int a, m(b j), b;
>
> Maybe I'm tired but what is m(b j) above? Is it valid C code? If it is
> what does it mean?
> Anyway in the code there isn't a type called "b". There's a type
> called "struct b", right?
Well, this is actually C++ code. In C++, declaring that struct is kinda
like doing this in C:
typedef struct a {int a; int b;} a;
And the m(b j) is a prototype for a function which is called 'm', takes a 'b'
structure as a parameter and the parameter name is 'j'. It's perfectly valid.
> [Klippa, klapp, kluppit rest of program and bison horror story.]
>
> I think the trick is to delay interpreting the lex/yacc output
> somewhat. Like building an incomplete syntax tree, which you then fill
> in with more information when you have the information that is
> necessary (the easiest is to do this when the whole source file has
> been parsed so you know there won't be any more information).
But, I'm just trying to parse the code, and the flexical tie-in would help
a lot to get rid of some of my reduce/reduce errors.
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT HotMail DOT com
ICQ: 32959047
- Raw text -