diff --git a/examples/test.modal b/examples/test.modal index 25b461d..f8c9e7b 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -1,6 +1,8 @@ -<> (explode ?*) (?*) +<> (explode ?*) (str (?*)) +<> (reverse (str (?h ?t))) (reverse/l ?t (?h)) +<> (reverse (str (?h))) (?h) +<> (reverse/l (?h ?t) ?l) (reverse/l ?t (?h ?l)) +<> (reverse/l (?h) ?l) (str (?h ?l)) +<> (implode str ?*) (?*) - -<> (?x pin) (done: ?x) - -(explode hello) pin \ No newline at end of file +(implode reverse (explode hello)) \ No newline at end of file diff --git a/src/modal.c b/src/modal.c index 1b50249..ca4a1f9 100644 --- a/src/modal.c +++ b/src/modal.c @@ -226,16 +226,16 @@ main(int argc, char **argv) if(argc < 2) return !printf("usage: modal [-v] source.modal\n"); if(argc < 3 && argv[1][0] == '-' && argv[1][1] == 'v') - return !printf("Modal - Modal Interpreter, 4 Apr 2024.\n"); + return !printf("Modal - Modal Interpreter, 7 Apr 2024.\n"); if(!(f = fopen(argv[1], "r"))) return !printf("Invalid Modal file: %s.\n", argv[1]); while(fread(&c, 1, 1, f)) { - if(prog_ > bank_a) { - if(c == ')' && *(w - 1) == ' ') w--; - if(c == '(' && *(w - 1) == ' ') w--; + if(w > bank_a) { + /* if(c == ')' && *(w - 1) == ' ') w--; */ + /* if(c == '(' && *(w - 1) == ' ') w--; */ + /* if(c == ' ' && *(w - 1) == '(') continue; */ + /* if(c == ' ' && *(w - 1) == ')') continue; */ if(c == ' ' && *(w - 1) == ' ') w--; - if(c == ' ' && *(w - 1) == '(') continue; - if(c == ' ' && *(w - 1) == ')') continue; } *w++ = c; }