Skip to content

Commit

Permalink
driver with command line (WIP)
Browse files Browse the repository at this point in the history
Need to go into each program and check argv for "print" then conditionally tell whether to print to screen or not.
  • Loading branch information
njmaysonet committed Jul 11, 2015
1 parent f973d58 commit 48ae890
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions Driver/driverCL.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include "scanner.h"
#include "parserwithcodegen.h"
#include "pmachine.h"
#include String.h

int main(int argc, char** argv)
{
int flagL = 0; //Lexeme list
int flagV = 0; //Virtual Machine
int flagA = 0; //Assembly

int i = 0;
for(i = 1; i < argc; i++)
{
if(!strcmp(argv[i],"-l")
{
flagL = 1;
}
else if(!strcmp(argv[i], "-v"))
{
flagV = 1;
}
else if(!strcmp(argv[i], "-a"))
{
flagA = 1;
}
}

//Lexer
if( flagL == 1)
{
scannermain("print");
printf("Scanner successful\n");
}
else if( flagL == 0)
{
scannermain();
printf("Scanner successful\n");
}

//Parser/Code
if(flagA == 1)
{
parsermain("print");
printf("Parsing and Code Generating successful\n");
}
else if(flagA == 0)
{
parsermain();
printf("Parsing and Code Generating successful\n");
}

//Virtual Machine
if(flagV == 1)
{
pmachinemain("print");
printf("Everything done\n");
}
else if(flagV == 0)
{
pmachinemain();
printf("Everything done\n");
}
return 0;
}

0 comments on commit 48ae890

Please sign in to comment.