Permalink
Browse files

-S instead of -s, and crash if file not found

  • Loading branch information...
1 parent aa077f0 commit 4e8ad43eae596b9f966b37a39cfcefec677c089f @andrewrk committed Oct 18, 2010
Showing with 7 additions and 4 deletions.
  1. +2 −3 cse440p1.files
  2. +1 −1 main.cpp
  3. +4 −0 pascal.y
View
@@ -3,9 +3,8 @@ code_generation.cpp
code_generation.h
insensitive_map.h
main.cpp
-output/lex.yy.cpp
-output/y.tab.cpp
-output/y.tab.hpp
+pascal.y
+pascal.l
parser.h
semantic_checker.cpp
semantic_checker.h
View
@@ -15,7 +15,7 @@ int main(int argc, char * argv[]) {
for (int i=1; i<argc; ++i) {
std::string arg = argv[i];
if (arg[0] == '-') {
- if (arg.compare("-s") == 0) {
+ if (arg.compare("-S") == 0) {
print_assembly = true;
} else {
std::cerr << "Unrecognized parameter: " << arg << std::endl;
View
@@ -430,6 +430,10 @@ object_instantiation: KEYWORD_NEW TOKEN_IDENTIFIER {
Program * parse_input(char * filename) {
if (filename != NULL) {
yyin = fopen(filename, "r");
+ if (yyin == NULL) {
+ fprintf(stderr, "%s not found.\n", filename);
+ exit(1);
+ }
}
yyparse();
return main_program;

0 comments on commit 4e8ad43

Please sign in to comment.