#include "parser.h"
#include "CGEngine/CCGFactory.h"
#include "CLIPSInterface/Control.h"
     
//main program
void main(void)
{
   char sourceFile[NAMESIZE];

   printf("Enter the CGIF file name:\n");
   fgets(sourceFile, NAMESIZE,stdin);
   int len = strlen(sourceFile);
   sourceFile[len-1]= '\0';

   //print the tokens
   //for (int i=0; i<newTokenNumber; i++)
	//   printf("token  %3d   %15s  %2d\n", i, simpleTokenList[i].value, 
	//           simpleTokenList[i].kind);

   // Initialize CLIPS
   CCLPControl clipsController;
   clipsController.Initialize();

   //generate all element from the token list, 
   //then transfer them to Factory through CG Engine
   CKnowledgeBase** KBPP = new CKnowledgeBase* ;
   ACCGFactory *pFactory = new CCGFactory;

   parser(sourceFile, KBPP, pFactory);

   clipsController.shell();
}
