added explicit 'compile' option
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 28 Oct 2021 17:49:56 +0000 (12:49 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Thu, 28 Oct 2021 17:49:56 +0000 (12:49 -0500)
src/onyx.c
src/wasm_runtime.c

index fb02bef8467b11f97ba7d217643e30f403bf3470..371c7e2342c51e101956198c2ed43c79c9973128 100644 (file)
@@ -31,7 +31,10 @@ static const char* docstring = "Onyx compiler version " VERSION "\n"
     "The compiler for the Onyx programming language, created by Brendan Hansen.\n"
     "\n"
     "Usage:\n"
-    "\tonyx [-o <target file>] [--verbose] <input files>\n"
+    "\tonyx compile [-o <target file>] [--verbose] <input files>\n"
+#ifdef ENABLE_RUN_WITH_WASMER
+    "\tonyx run <input files> -- <args>\n"
+#endif
     // "\tonyx doc <input files>\n"
     "\tonyx help\n"
     "\n"
@@ -90,6 +93,10 @@ static CompileOptions compile_opts_parse(bh_allocator alloc, int argc, char *arg
     i32 arg_parse_start = 1;
 
     if (!strcmp(argv[1], "help"))     options.action = ONYX_COMPILE_ACTION_PRINT_HELP;
+    if (!strcmp(argv[1], "compile")) {
+        options.action = ONYX_COMPILE_ACTION_COMPILE;
+        arg_parse_start = 2;
+    }
     #ifdef ENABLE_RUN_WITH_WASMER
     else if (!strcmp(argv[1], "run")) {
         options.action = ONYX_COMPILE_ACTION_RUN;
index 792cba328b6dcae2a48b2db4d7e3a98fbe9b94aa..bb96e99e3a7df234dfe5f3c1190156b2c52b4f4a 100644 (file)
@@ -4,7 +4,7 @@
 #include "wasmer.h"
 
 #ifndef WASMER_VERSION
-    #error "Currently, building the Onyx compile with built-in execution support requires the Wasmer library to be compiled and linked."
+    #error "Currently, building the Onyx compiler with built-in execution support requires the Wasmer library to be compiled and linked."
 #endif
 
 void onyx_run_wasm(bh_buffer wasm_bytes) {