Re: x + (y) + z

2005-03-04 Thread Derek M Jones
Kelly,


>> to
>> 
>> add-expr:
>> mul-expr|
>> mult-expr '+' add-expr |
>> mult-expr '-' add-expr ;
>> 
>
>I don't think that's what you want if you're planning
>on executing the code you generate from this...

A subsequent phase of processing can be used to
reverse this syntactic decision.

>By the way, you might want to have a look at 
>
>http://www.lysator.liu.se/c/ANSI-C-grammar-y.html

Thanks, but this grammar requires a symbol table.
It also contains lots of shift/reduce and reduce/reduce
conflicts, and if I was writing a more conventional grammar
I would want to remove these.


derek

--
Derek M Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd mailto:[EMAIL PROTECTED]
Applications Standards Conformance Testing   http://www.knosof.co.uk




___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


Re: x + (y) + z

2005-03-04 Thread Derek M Jones
Frank,

>> The statement (y)+z can be parsed as casting
>> +z to the type y, or as adding y to z.  A couple of
>> %dprecs solve this problem (I think the cast is the
>> common case for - and a binary expression for +).
>
>What the "common case" is doesn't really matter since a correct
>parser should be able to recognize all valid inputs, not only the
>most common ones. So if I understand right what you plan, this would
>all be just heuristics which don't really solve the problem.

Since both parses will recognise the input one has to be
selected.  Picking the common case means that there is
less work which has to be undone later in the semantics phase.


derek

--
Derek M Jones tel: +44 (0) 1252 520 667
Knowledge Software Ltd mailto:[EMAIL PROTECTED]
Applications Standards Conformance Testing   http://www.knosof.co.uk




___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


Re: x + (y) + z

2005-03-04 Thread Hans Aberg
At 20:41 + 2005/03/03, Derek M Jones wrote:
>The statement (y)+z can be parsed as casting
>+z to the type y, or as adding y to z.  A couple of
>%dprecs solve this problem (I think the cast is the
>common case for - and a binary expression for +).

The normal way to resolve this would be to let the lexer check the lookup
table to see what y is: a type or a number identifier, and then return that
type. WHy does this not work for you.

>However, things are more complicated for x + (y) + z,
>whose parse tree can be either
>
>+
>  /\
> x ( )
>   /   \
>  y +
> |
> z
>
>or
>
>   +
>  /   \
>+ z
>   /  \
> x(y)
>
>As currently implemented the %dprec functionality does
>not appear to be any help here.  Effectively, it will only
>select between two productions that consume the same
>number of input tokens.

The commands %left and %right handles left and right associativity.

  Hans Aberg




___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


Re: x + (y) + z

2005-03-04 Thread Frank Heckenbach
Derek M Jones wrote:

> >> The statement (y)+z can be parsed as casting
> >> +z to the type y, or as adding y to z.  A couple of
> >> %dprecs solve this problem (I think the cast is the
> >> common case for - and a binary expression for +).
> >
> >What the "common case" is doesn't really matter since a correct
> >parser should be able to recognize all valid inputs, not only the
> >most common ones. So if I understand right what you plan, this would
> >all be just heuristics which don't really solve the problem.
> 
> Since both parses will recognise the input one has to be
> selected.  Picking the common case means that there is
> less work which has to be undone later in the semantics phase.

Undoing and reversing parsing (as you also mentioned in another
mail) may be an option, but IMHO not a very good one, if you can't
use the parser the way it's supposed to.

But since you don't state why you don't do the usual thing (separate
token for type names), I can't say anything more ...

Frank

-- 
Frank Heckenbach, [EMAIL PROTECTED]
http://fjf.gnu.de/
GnuPG and PGP keys: http://fjf.gnu.de/plan (7977168E)


___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison


www.vendorsname.ws - The world famous carders' forum is back now!!!

2005-03-04 Thread sales
During the battle with US Secret Service, we fucked all those LE bastards and  
now we are running a brand new, improved and the biggest carder' forum you ever 
seen. 
On our forum you can buy: 
 
* Credit cards with Change Of Billing (COBs) 
* Dumps of US and European credit cards (Platinum, Gold and Classic) 
* Active eBay accounts with as many positive feedbacks as you need 
* Active and wealthy PayPal accounts 
* Drops for carding, cashing and money laundering 
* Carded electronic and stuff for as low as 40 percent of market price 
* PINs for prepaided AT&T and Sprint phone cards 
* Carded Western Union accounts for safe and quick money transfers 
* Carded UPS and FedEx accounts for quick and free worldwide shipping of your 
stuff   
* Full info including Social Security Info, Driver Licence #, Mother' Maiden 
Name and much more 
* DDoS attack for any site you need, including monsters like Yahoo, Microsoft, 
eBay 
 
Come and register today and get a bonus by your choice: 
- One Citybank account with online access with 3k on board, or 
- 5 COB' cards with 5k credit line  
- 10 eBay active eBay accounts with 100+ positive feedbacks 
- 25 Credit Cards with PINs for online carding 
 
Be in first 10 who register today and get the very special bonus from 
Administration of Forum. 
 
You can always apply with any questions to: 
 
Kral, Petr 
[EMAIL PROTECTED] 
+1-312-933-1046 
 
CONTACT us by ICQ: 
ICQ # : 166046405  
Windows messenger:  [EMAIL PROTECTED] 
Live Chat : http://www.fdcservers.net  
  
CONTACT us by MAIL: 
FDCSERVERS.NET LLC 
141 W. Jackson Blvd. #1135 
Chicago, IL 60604




___
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison