diff --git a/src/modal.c b/src/modal.c index 0ec64e5..06bc49e 100644 --- a/src/modal.c +++ b/src/modal.c @@ -71,8 +71,7 @@ bind(char r) { int depth = 0; char c, *s = regs[(int)r]; - if(!s) - return !printf("!! Reading from invalid register: ?%c\n", r); + if(!s) return !printf("?%c Empty\n", r); if(s[0] == '(') { while((c = *s++)) { if(c == '(') depth++; @@ -172,6 +171,7 @@ static void print_rules(void) { int i; + printf("\n"); for(i = 0; i < rules_len; i++) printf("<> (%s) (%s)\n", rules[i].a, rules[i].b); printf("\n"); @@ -182,8 +182,7 @@ parse_line(char *line) { char c; if(line[0] == 0) return 1; - if(line[0] == '<' && line[1] == '>') - return !!addrule(line); + if(line[0] == '<' && line[1] == '>') return !!addrule(line); while((c = *line++)) *prog_++ = c; return 1; @@ -216,9 +215,9 @@ main(int argc, char **argv) return !printf("Modal - Modal Interpreter, 4 Apr 2024.\n"); if(!parse(argv[1])) return !printf("Invalid Modal file: %s.\n", argv[1]); - print_rules(); printf(".. %s\n", bank_a); while(rewrite()) ; + print_rules(); return 0; } \ No newline at end of file