diff --git a/DragonLisp.y b/DragonLisp.y index 2a5f8e0..e937c93 100644 --- a/DragonLisp.y +++ b/DragonLisp.y @@ -96,6 +96,8 @@ namespace DragonLisp { %define parse.error verbose +%start S + %% S diff --git a/DragonLispDriver.cpp b/DragonLispDriver.cpp index aba1dc1..6fc9488 100644 --- a/DragonLispDriver.cpp +++ b/DragonLispDriver.cpp @@ -14,8 +14,10 @@ DLDriver::~DLDriver() { int DLDriver::parse(const std::string& f) { std::ifstream in(f); - if (!in.good()) + if (!in.good()) { + std::printf("Could not open file %s\n", f.c_str()); return 1; + } return this->parse(in, f); } diff --git a/main.cpp b/main.cpp index 48997e1..42a62b9 100644 --- a/main.cpp +++ b/main.cpp @@ -2,7 +2,9 @@ #include "DragonLispDriver.hh" -int main() { +int main(int argc, char** argv) { DragonLisp::DLDriver driver; - return driver.parse(std::cin); + if (argc <= 1) + return driver.parse(std::cin); + return driver.parse(argv[1]); }