summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/solar.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/solar.cpp b/src/solar.cpp
index e0fbba0..c022a6d 100644
--- a/src/solar.cpp
+++ b/src/solar.cpp
@@ -74,11 +74,16 @@ bool read_grammar(const char *filename, parser_state_t *state) {
}
-int main() {
+int main(int argc, char *argv[]) {
using namespace solar;
+ if (argc < 2) {
+ std::fprintf(stderr, "Usage: solar FILE\n");
+ return 1;
+ }
+
parser_state_t state;
- if (!read_grammar("grammar.y", &state))
+ if (!read_grammar(argv[1], &state))
return 1;
generator_t generator(state.get_rules());