Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Danny Pereira Newsgroups: comp.compilers Subject: Re: warning: assignment makes pointer from integer without a cast[enabled by default] yylval=atoi(yytext); Date: Mon, 22 Feb 2016 09:28:49 +0530 Organization: Compilers Central Lines: 167 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <16-02-003@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Injection-Info: miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="15928"; mail-complaints-to="abuse@iecc.com" Keywords: yacc, question, comment Posted-Date: 24 Feb 2016 08:23:20 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:1666 Hello all, I am trying to write a simple calculator application using re-entrant lex and yacc. Here I wish to create two threads (parsers) which should parse input provided in input file. Lines to be parsed in input file are divided among two threads.. My lex code for simple calculator is %option reentrant bison-bridge %option noyywrap %{ #include void yyerror(char *); #include "y.tab.h" %} %% [0-9]+ { yylval=atoi(yytext); return INTEGER; } [-+\n] return *yytext; [ \t] ;/* Skip whitespaces*/ . ; %% *My yacc file for simple calculator(reentrant) is* %pure-parser %lex-param {void * scanner} %parse-param {void * scanner} %{ #include #include #include #include #include #include FILE * f[2]; pthread_mutex_t lock; int cnt=0; void* scanfunc(void * ); %} %token INTEGER %% program: program expr '\n' {printf("%d\n", $2);} | ; expr: INTEGER {$$=$1;} |expr '+' expr {$$=$1+$3;} |expr '-' expr {$$=$1-$3;} ; %% void yyerror(char *s){ fprintf(stderr,"%s\n",s); } int main(int argc, char *argv[]){ pthread_t threads[2]; int n=2,i;//Number of threads to be created //set_file_ptr(); if(argc!=2){ printf("Insufficient nos. of arguments\n"); exit(0); } for(i=0;i> I have posted my question on stack-overflow. Link of question is >> http://stackoverflow.com/questions/35459610/segmentation-fault-in-re-entrant-yacc-parser-code -- Regards Pereira Danny Jeron I/c Head,Department Of Computer Engineering, Govt. College of Engg and Research, Avasari(Kd), Pune [I suggested he debug it the usual way, by putting breakpoints in the C code to narrow down the places where it was smashing stuff. -John]