diff --git a/examples/hello.modal b/examples/hello.modal new file mode 100644 index 0000000..dd63d61 --- /dev/null +++ b/examples/hello.modal @@ -0,0 +1,4 @@ +<> (?x dup) (?x ?x) +<> (?x ?y swap) (?y ?x) + +foo ((A B swap) dup) \ No newline at end of file diff --git a/examples/test.modal b/examples/test.modal index dd63d61..a520c1c 100644 --- a/examples/test.modal +++ b/examples/test.modal @@ -1,4 +1,3 @@ -<> (?x dup) (?x ?x) -<> (?x ?y swap) (?y ?x) +<> (duppre ?x) (?x ?x) -foo ((A B swap) dup) \ No newline at end of file +what (duppre twice) \ No newline at end of file diff --git a/src/modal.c b/src/modal.c index fd7fa6f..8ab0a04 100644 --- a/src/modal.c +++ b/src/modal.c @@ -128,8 +128,11 @@ tokenize(char *t, FILE *f) r->a = parse_rulefrag(f), r->b = parse_rulefrag(f); return; } + while((c = *t++)) + *prog_++ = c; + *prog_++ = ' '; while(f && fread(&c, 1, 1, f) && c) - *prog_++ = c == 0xa ? 0x20 : c; + *prog_++ = c == 0xa ? ' ' : c; } static int