Related articles |
---|
[LONG&BORING] ULR : Ultimate LR parser =) deadcow@free.fr (Nicolas Repiquet) (2003-10-27) |
Re: [LONG&BORING] ULR : Ultimate LR parser =) oliver@zeigermann.de (Oliver Zeigermann) (2003-10-31) |
From: | Oliver Zeigermann <oliver@zeigermann.de> |
Newsgroups: | comp.compilers |
Date: | 31 Oct 2003 23:05:39 -0500 |
Organization: | T-Online |
References: | 03-10-112 |
Keywords: | parse, LALR |
Posted-Date: | 31 Oct 2003 23:05:39 EST |
Nicolas Repiquet wrote:
> - a precedence level
> - an associative indication
This is exactly what YACC offers you to resolve ambiguities. You may
write for example
%left '+' '-'
%left '*' '/'
to make '+', '-', '*' and '/' left associative and give '*' and '/'
precedence over '+' and '-'. Seems you reinvented the wheel :)
Note, however, this does not augment the set of parsable languages, but
only helps to eliminate ambiguities in the grammar. This means, you
could rewrite the grammar to parse the same language and not use
operator precedence - although it will certainly look less obvious then.
Oliver
Return to the
comp.compilers page.
Search the
comp.compilers archives again.