tags:

views:

11

answers:

0

I am using Yacc and lex to parse a C type language , I have built the data structures using c++. everything works fine but i am not able to read the input file using yyin in main.cpp.

the following is the code : Please help !

#include "parse_tree.h"
#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include"y.tab.h"

extern "C" FILE *yyin;
FILE *fp;

using namespace std;

int main() {



 system("clear");

 yyin=fopen("input_file","r+");
 if(yyin==NULL)
 {
  cout<<"\n Error ! \n";
 }
 do{
  cout<<"am parsing !"; 
      yyparse();

 }while(!feof(yyin));
     return 0;


 fp=fopen("outfile","w");

 yyparse();
 }


int yywrap()
{

 return 1;

}