Message-ID: <3786BC45.B89C14F5@unb.ca> From: Endlisnis Organization: Nortel Networks X-Mailer: Mozilla 4.51 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp,comp.programming Subject: Re: Bison and [f]lexical tie-ins References: <37863AAA DOT BF85DE25 AT americasm01 DOT nt DOT com> <7m5r26$see$1 AT news DOT luth DOT se> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 41 Date: Sat, 10 Jul 1999 03:20:30 GMT NNTP-Posting-Host: 209.226.124.243 X-Trace: news20.bellglobal.com 931576830 209.226.124.243 (Fri, 09 Jul 1999 23:20:30 EDT) NNTP-Posting-Date: Fri, 09 Jul 1999 23:20:30 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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