LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-17-2011, 03:24 PM   #1
moushas
LQ Newbie
 
Registered: Jun 2011
Posts: 1

Rep: Reputation: Disabled
YACC conflicts


Hello,

i'm programming an SQL grammar using YACC and during compilation i got this error:
conflits: 1 shift/reduce, 2 reduce/reduce

the first error : shift/reduce

Code:
scalar_exp:

		scalar_exp PLUS scalar_exp 

	| 	scalar_exp NEG scalar_exp 

	|	scalar_exp MULT scalar_exp  

	|	scalar_exp DIV scalar_exp 

	| 	atom

	|	column_ref

	|	function_ref

	|	OPENPAREN scalar_exp CLOSEPAREN
        ;

function_ref:

		AMMSC OPENPAREN MULT CLOSEPAREN /* COUNT(*) */

	| 	AMMSC OPENPAREN DISTINCT column_ref CLOSEPAREN

	| 	AMMSC OPENPAREN ALL scalar_exp CLOSEPAREN

	| 	AMMSC OPENPAREN scalar_exp CLOSEPAREN

	;
the error is that MULT appears twice in the code
Code:
MULT      [réduction par utilisation de la règle 212 (parameter)]


the second erro: 2 reduce/reduce

Code:
 88 values_or_query_spec: VALUES OPENPAREN . insert_atom_commalist CLOSEPAREN

    STRING     décalage et aller à l'état 57
    INTNUM     décalage et aller à l'état 58
    APPROXNUM  décalage et aller à l'état 59
    USER       décalage et aller à l'état 61
    NULLX      décalage et aller à l'état 305
    DEUXPOINT  décalage et aller à l'état 63

    INDICATOR   réduction par utilisation de la règle 212 (parameter)
    CLOSEPAREN  réduction par utilisation de la règle 90 (insert_atom_commalist)
    CLOSEPAREN  [réduction par utilisation de la règle 212 (parameter)]
    COMMA       réduction par utilisation de la règle 90 (insert_atom_commalist)
    COMMA       [réduction par utilisation de la règle 212 (parameter)]
    $défaut    réduction par utilisation de la règle 90 (insert_atom_commalist)

    insert_atom_commalist  aller à l'état 306
    insert_atom            aller à l'état 307
    atom                   aller à l'état 308
    parameter_ref          aller à l'état 68
    literal                aller à l'état 70
    parameter              aller à l'état 72
the two conflics are about comma and CLOSEOPEN
Code:
 CLOSEPAREN  réduction par utilisation de la règle 90 (insert_atom_commalist)
    CLOSEPAREN  [réduction par utilisation de la règle 212 (parameter)]
    COMMA       réduction par utilisation de la règle 90 (insert_atom_commalist)
    COMMA       [réduction par utilisation de la règle 212 (parameter)]
    $défaut    réduction par utilisation de la règle 90 (insert_atom_commalist)
the error is about CLOSEPAREN and COMMA

the grammar:

Code:
values_or_query_spec:

		VALUES OPENPAREN insert_atom_commalist CLOSEPAREN

	|	query_spec

	;

insert_atom_commalist:

	|	insert_atom

	| 	insert_atom_commalist COMMA insert_atom

	;	

insert_atom:

		atom

	| 	NULLX

	;



i'm asking for giving me the solution if you can




tanks

Last edited by moushas; 06-17-2011 at 03:55 PM.
 
Old 06-17-2011, 10:33 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,610
Blog Entries: 4

Rep: Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905Reputation: 3905
http://en.youxu.info/?p=130
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel26-firmware conflicts with linux-firmware conflicts with nvidia-96xx Bratmon Arch 3 06-26-2010 07:42 PM
Yacc conflicts - How to understand grammar conflict dayalan_cse Programming 6 06-15-2010 08:04 AM
Where to get Yacc? kaydknight Linux - Software 2 12-08-2005 02:59 AM
yacc problem zchoyt Programming 0 03-23-2005 08:23 AM
problem with yacc fssengg Programming 3 03-09-2005 10:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration