|
From: | Ramaswamy |
Subject: | Ambiguous Grammar |
Date: | Mon, 26 May 2003 14:45:08 +0530 |
Hi,
I am working on a very ambiguous
language. The language is ambiguous due to the support for complete forward
referencing. Worst yet its meant to be user friendly which means its a headache
for the compiler designers. Considering so many factorts and limited time
available I choose to use the GLR parsing scheme provided by bison. On most
ambiguous situations I am able to parse the input excepting on when the parser
finds and ambiguity. Anyway this is as follows -
Withing enclosed braces the
following language is permitted -
TokenList:
Token
| TokenList Token
;
And the token is unfortunately as
follows:
Token:
A
| B
| C
| and a lot more which r out of
scope of the prblm
;
C: A B
The actual grammar is not this
elementary but I prefer presenting the base problem rather that giving other
unwanted details. The language permits the tokens A & B
in TokenList without any other tokens in b/w as in production C. The
language specification says that there is no ambiguity, but due to forward
referencing I face this problem. All I want to do is get the parser to go
thru using any of the 2 ways of the following ambiguity for the input { ... A B
....}, preferably the one with the longer string -
TokenList->
TokenList->
TokenList->... (before A)
Token->A
Token->B
and
TokenList->
TokenList->... (before
A)
Token->C (with is an A
followed by a B)
I could not find out where in
the grammar I should give the %dprec to let the grammar take the longer
contineuous token (C). In case any of u can solve this problem or could give
links to relavent links it would be great. Thanks in advance.
Regds
Ram --------------------- Information contained and transmitted by this E-MAIL is proprietary to Synergy Infotech Private Limited and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If this is a forwarded message, the content of this E-MAIL may not have been sent with the authority of the Company. If you are not the intended recipient, an agent of the intended recipient or a person responsible for delivering the information to the named recipient, you are notified that any use, distribution, transmission, printing, copying or dissemination of this information in any way or in any manner is strictly prohibited. We have taken precautions to minimize the risk of transmitting software viruses, but we advise you to carry out your own virus checks on any attachment to this message. We cannot accept liability for any loss or damage caused by software viruses. If you have received this communication in error, please delete this mail & notify us immediately at mailto:address@hidden |
[Prev in Thread] | Current Thread | [Next in Thread] |