I think the conflict may be here(I may be wrong) :<div>When parser encounter C , it can reduce to y or it can shift i.e it think there is A waiting to be read, hence shift/reduce conflict</div><div><br></div><div><br></div>
<div><br></div><div> <br><br><div class="gmail_quote">On Mon, Jan 16, 2012 at 2:49 PM, Dmitry Pavlov <span dir="ltr"><<a href="mailto:dpavlov@ipa.nw.ru">dpavlov@ipa.nw.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello all,<br>
<br>
I am having trouble with yacc parser giving shift/reduce<br>
conflict, while I do not see where the conflict can be.<br>
I have simplified the grammar to the following one:<br>
<br>
<br>
#lang racket<br>
<br>
(require parser-tools/yacc<br>
parser-tools/lex)<br>
<br>
(define-empty-tokens my-tokens (EOF A B C))<br>
<br>
(define (my-parser source-name)<br>
(parser<br>
(start start)<br>
(end EOF)<br>
(tokens my-tokens)<br>
(error #f)<br>
(grammar<br>
(start ((x) $1))<br>
(x<br>
((y A B) (list $1 'ab)))<br>
(y<br>
((C) 'c)<br>
((C A) 'ca)))))<br>
<br>
<br>
It reports "1 shift/reduce conflict".<br>
But from my primitive point of view, the parser should<br>
accept only "CAB" and "CAAB" inputs, so there is no chance<br>
for a conflict here. Could please anybody point me on what<br>
is not correct with my understanding?<br>
<br>
<br>
Best regards,<br>
<br>
Dmitry<br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/<u></u>users</a><br>
</blockquote></div><br></div>