Ground REPL

This commit is contained in:
2026-03-19 16:00:46 +11:00
parent 2df8d2848d
commit fd118369d3
9 changed files with 79 additions and 11 deletions

View File

@@ -3,6 +3,7 @@
#include "compiler.h"
#include "types.h"
#include "serialize.h"
#include "repl.h"
#include <stdio.h>
#include <string.h>
@@ -43,9 +44,8 @@ char* getFileContents(const char* filename) {
}
int main(int argc, char** argv) {
if (argc < 2) {
printf("Usage: %s <file> [-c] [--compile] [-h] [--help]\n", argv[0]);
exit(1);
if (argc == 1) {
exit(repl());
}
bool compile = false;
@@ -71,7 +71,7 @@ int main(int argc, char** argv) {
printf(" -w <output> or --writebytecode <output>: Outputs binary Ground bytecode");
printf(" -b <output> or --bytecode <output>: Inputs binary Ground bytecode");
exit(0);
} else if (strcmp("--writebytecode", argv[i]) == 0 || strcmp("-w", argv[i]) == 0) {
} else if (strcmp("--writeBytecode", argv[i]) == 0 || strcmp("-w", argv[i]) == 0) {
if (compile) {
printf("Cannot choose both bytecode and compilation");
exit(1);