LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 03-23-2005, 08:23 AM   #1
zchoyt
Member
 
Registered: Feb 2003
Location: Boise ID
Distribution: fedora
Posts: 156

Rep: Reputation: 30
yacc problem


I have two productions:

F: F '+' G {$$=$1+$3;}
| F '-' G {$$=$1-$3;}
| G {$$=$1;}
;
........
........
K: L '+''+' {
/*if($3=='+')*/
/*{*/
$$=$1++;
/*}*/
/*else*/
/*{*/
/*$$=$1;*/
/*}*/
/*printf("%d",$3);}*/

The problem I am having is that when I enter 4++, the bottom production catches it which is OK, but if I enter 4+4 then it catches in the bottom prodution and errors out. I tried checking $3 but it errors on me saying that '+' is untyped. How can I overcome this?
 
  


Reply



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
does ubuntu have lex and yacc,how to use them?? akshay_jp Linux - Software 4 05-26-2010 06:36 PM
LEX and YACC with C gr33ndata Programming 4 11-18-2007 05:12 PM
Bison and Yacc Compatibility Problem oulevon Programming 1 10-23-2005 10:56 PM
problem with yacc fssengg Programming 3 03-09-2005 10:56 AM
yacc, Bison Config Linux - General 6 02-21-2002 02:18 PM

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

All times are GMT -5. The time now is 03:45 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