Re: 2 Yacc Qs

Brian Bliss <brianb@microware.com>
27 Mar 1997 13:20:20 -0500

          From comp.compilers

Related articles
2 Yacc Qs zero@istar.ca (1997-03-22)
Re: 2 Yacc Qs Bronikov@ic.net (Dmitri Bronnikov) (1997-03-23)
Re: 2 Yacc Qs brianb@microware.com (Brian Bliss) (1997-03-27)
| List of all articles for this month |

From: Brian Bliss <brianb@microware.com>
Newsgroups: comp.compilers
Date: 27 Mar 1997 13:20:20 -0500
Organization: Microware Systems
References: 97-03-135
Keywords: yacc, parse, syntax

Barton Jaques wrote:
>
> I am building an expression grammar and having problems with associativity
> and shift/reduce conflicts. The language I am emulating permits a statement
> like this:
>
> set y to items 1 thru 2 of x as string
>
> which should be read as: "set y to (items 1 thru 2 of x) as string"
> and not as: "set y to items 1 thru 2 of (x as string)"
>
...
> expression:
> object_specifier
> | IDENT
> | expression AS class
>
...


try


  %left AS


this will cause the parser to reduce when it encounters a shift-reduce
conflict and AS is the input token, wereas


  %right AS


will cause the parser to shift (the default) when it encounters a shift-
reduce conflict and AS is the input token.


bb
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.