www.pudn.com > Micro.rar > Micro.cpp


// Micro.cpp : Defines the entry point for the console application. 
// 
 
#include "stdafx.h" 
#include "Lex.h" 
#include "Syntax.h" 
#include  
#include  
#include  
#include  
#include  
 
using namespace std; 
/* 
begin    0 
  a := 25; 
4 
10 
5 
8 
end 
3 
^Z  -1 
13 
*/ 
 
/* 
extern struct AA; 
struct AA { 
}; 
//int AA::a; 
class CA {public: 
	static int a; 
}; 
int CA::a; 
*/ 
FILE * outfp = NULL; 
FILE * infp = NULL; 
char * outfile = "t1.out.txt"; 
char *  infile = "mc.in.txt"; 
bool   infromfile	= true; 
bool   out2file	= true; 
 
 
int _tmain(int argc, _TCHAR* argv[]) 
{ 
	/* 
	clock_t  beg = clock(); 
	system("pause"); 
	clock_t  end = clock(); 
	cout<<(end)/CLOCKS_PER_SEC< 1 ) { 
		return 1; 
	}	// JNWKADCM 
	*/ 
	/*  // for test lex 
	token tk; 
	while( (tk = scanner()) != SCANEOF ) { 
		printf("%d  %s\n", tk, getTokenText(tk)); 
	} 
	printf("%d  %s\n", tk, getTokenText(tk)); 
	*/ 
	 
	// 选择输出到文件 
	if( out2file ) { 
		//outfp = fopen(outfile, "w"); 
		outfp = freopen(outfile, "w", stdout); 
		if( ! outfp ) { 
			error("create file fail."); 
		} 
	} 
	// 选择从文件输入 
	if( infromfile ) { 
		//infp = fopen(infile, "r"); 
		infp = freopen(infile, "r", stdin); 
		if( ! infp ) { 
			error("file not exists."); 
		} 
	} 
	system_goal(); 
 
 
	if( out2file ) { 
		freopen("CON", "w", stdout);//   printf("I'm back.\n"); 
	} 
	if( infromfile ) { 
		freopen("CON", "r", stdin); 
	} 
	//fclose(outfile); 
	//fclose(infp); 
	 
	return 0; 
}