forked from KevinDuarte/COP3402-Module-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Need to go into each program and check argv for "print" then conditionally tell whether to print to screen or not.
- Loading branch information
1 parent
f973d58
commit 48ae890
Showing
1 changed file
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |