Yacc: reduce/reduce

This is a discussion on Yacc: reduce/reduce within the Tech Board forums, part of the Community Boards category; I got message from yacc as follows Code: $yacc -v parser.y conflicts: 2 reduce/reduce Now the figure "2", does it ...

  1. #1
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696

    Yacc: reduce/reduce

    I got message from yacc as follows
    Code:
    $yacc -v parser.y
    conflicts: 2 reduce/reduce
    Now the figure "2", does it refer to state 2 or grammar 2 in y.output?
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  2. #2
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    I guess it refers to state 2
    Code:
    state 2
      0 $accept: program . $end
      $end shift, and go to state 4
    Doesn't the conflict message says that input: program . $end, can be reduced into two different "right hand side"s: $accept and what is the other one?

    Why doesn't my conflict message say it more clearly like the following example from a website?
    Code:
    5: reduce/reduce conflict (reduce 3, reduce 4) on c
    state 5
            B : x y .  (3)
            E : x y .  (4)
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    Now the figure "2", does it refer to state 2 or grammar 2 in y.output?
    It refers to state 2, I believe. Down below, you ought to be able to look at the state machine the grammer generates. When there's a reduce-reduce, you'll have two possible reduce transitions. Your yacc is likely symbolically linked to bison which might explain the different output file.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Three Address Code generation using Lex, Yacc
    By Raman in forum C Programming
    Replies: 1
    Last Post: 11-04-2008, 09:04 AM
  2. Yacc questions
    By g_p in forum Tech Board
    Replies: 1
    Last Post: 05-27-2007, 07:10 AM
  3. draw tree graph of yacc parsing
    By talz13 in forum C Programming
    Replies: 2
    Last Post: 07-23-2006, 02:33 AM
  4. flex & YACC question
    By cboard_member in forum Tech Board
    Replies: 2
    Last Post: 03-23-2006, 04:58 AM
  5. using YACC and lex to make your own shell...
    By YankeePride13 in forum Linux Programming
    Replies: 2
    Last Post: 12-28-2005, 10:00 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21