yacc: type clashes and useless nontermins

This is a discussion on yacc: type clashes and useless nontermins within the Linux Programming forums, part of the Platform Specific Boards category; Hi Im trying to write a simple compiler and I'm stuck at the parsing/yacc phase. I keep getting many of ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    57

    yacc: type clashes and useless nontermins

    Hi

    Im trying to write a simple compiler and I'm stuck at the parsing/yacc phase. I keep getting many of these errors and warnings:
    • type clash on default action
    • empty rule for typed nonterminal
    • useless rule


    Anyone have any advice on how to tackle these? I attached my lex and yacc output files too incase that helps any.

    Thanks
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Apr 2008
    Posts
    395
    If you get those errors, the rules described by your grammar are ambiguous and incomplete. You should try a progressive approach, by adding one rule at a time, check it works, and resume. Lex/yacc does not support all grammar classes, this is a complex topic and you have to either use a simple grammar or know well what you're doing...

Popular pages Recent additions subscribe to a feed

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