From 680a039cf91b01525c5d77f4cf54e1484d47093f Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Tue, 7 May 2024 08:20:39 -0700 Subject: [PATCH] Removed lambda rule memory --- src/modal.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/modal.c b/src/modal.c index bf8e2f4..7d69815 100644 --- a/src/modal.c +++ b/src/modal.c @@ -6,7 +6,7 @@ typedef struct { } Rule; static int flip, quiet, debug, cycles = 0x200000; -static Rule rules[0x1000], *rules_ = rules, lambda; +static Rule rules[0x1000], *rules_ = rules; static char dict[0x8000], *dict_ = dict, empty; static char bank_a[0x4000], *src_ = bank_a; static char bank_b[0x4000], *dst_ = bank_b; @@ -252,17 +252,17 @@ rewrite(void) } /* phase: lambda */ if(c == '?' && s[1] == '(') { - char *d_ = dict_; + char *d = dict_; cap = walk(s + 1); - r = &lambda, r->id = -1; + r = rules_, r->id = -1; parse_frag(&r->b, parse_frag(&r->a, s + 2)); s = cap; while(*s == ' ') s++; - if(!apply_rule(&lambda, s)) { + if(!apply_rule(r, s)) { if(!quiet) fprintf(stderr, "%02d %s\n", r->id, src_), ++r->refs; write_tail(s); } - dict_ = d_; + dict_ = d; return 1; } /* phase: match */ @@ -286,7 +286,7 @@ main(int argc, char **argv) return !printf("usage: modal [-vqn] source.modal\n"); for(i = 1; i < argc && *argv[i] == '-'; i++) { switch(argv[i][1]) { - case 'v': /* version */ return !printf("Modal Interpreter, 4 May 2024.\n"); + case 'v': /* version */ return !printf("Modal Interpreter, 7 May 2024.\n"); case 'q': /* quiet */ quiet = 1; break; case 'p': /* debug */ debug = 1; break; case 'n': /* infinite */ cycles = 0xffffffff; break;