delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/30/12:30:08

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: Bison and particular expressions.
Date: Tue, 29 Jun 1999 17:57:25 -0600
Message-ID: <01bec28b$24067c00$LocalHost@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com

>> item can be resolved to be any number of smaller tokens.  for example,
item
>> could be a nonterminal that can match 'a', '*a', '**a', or '**&a'.  i
find
>> that using the most general definition possible, until you get to a
terminal
>> is usually the most efficient and easiest method to use.
>
>    That is kind of what I do, but the original problem was:
>list: parm ',' parm ','
>otherlist: parm ',' parm ';'
>
>Bison can't parse this correctly because it would require more than 1
>look-ahead token.


yeah, that's what I was trying to say.  i had this same problem, only it was
resolving immediate infix expressions with runtime infix expressions (e.g.,
one where you know the value of all parts of the expression, and one where
you don't.)

>> >I've think I got typedef's working, as well as structs and simple
classes
>> >(without methods) without lexical tie-ins.  Besides, scope stuff can be
>> done to
>> >make lexical tie-ins tricky [like]:
>> >struct a {int a;};
>> >
>> >int j()
>> >{int m,a;
>> >}
>>
>>     This is precisely what i refered to.  That's why C also has the
>> most-closely nested rule If your symbol
>> table knows where you are, and also knows where a variable was declared,
it
>> can then easily resolve the above example
>
>    But, lexical tie-ins and scope resolution are not required for what I
was
>doing.  All I was oringinally trying to do was to find things that look
like
>function declarations.  I wasn't really conserned with validating the
return
>type.   In my parser:
>
>myType myFunc(int a, char**&);
>
>would be a valid prototype even if "myType" was not previously defined.  My
>program is only designed to be run on code that cleanly compiles and thus
does
>not require strict validation of stuff like that.

ah.  :-)  Occam's Razor.  what is it, like a source documentor?

    -={C}=-

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019