Fixed rewrite count
This commit is contained in:
parent
d24af00098
commit
c619581739
|
@ -127,9 +127,13 @@ nap tap (inline 1) test
|
||||||
|
|
||||||
?(?-) (Arithmetic)
|
?(?-) (Arithmetic)
|
||||||
|
|
||||||
?((?: ?0 ?1 ?2) (?:)) + 1 2 3 = 6 (Arithmetic 1) test
|
?((?: ?0 ?1 ?2) ?:) + 1 2 3 = 6 (Arithmetic 1) test
|
||||||
?((?0 ?: ?1) (?:)) 16 - 8 = 8 (Arithmetic 2) test
|
?((?0 ?: ?1) ?:) 16 - 8 = 8 (Arithmetic 2) test
|
||||||
?((?0 ?1 ?:) (?:)) 12 10 * = 120 (Arithmetic 3) test
|
?((?0 ?1 ?:) ?:) 12 10 * = 120 (Arithmetic 3) test
|
||||||
|
|
||||||
|
<> (?0 ?1 `?:) (?:)
|
||||||
|
|
||||||
|
(12 45 `+ -2 `+) = (55) (Arithmetic 4) test
|
||||||
|
|
||||||
?(?-) (Late Test Primitives)
|
?(?-) (Late Test Primitives)
|
||||||
|
|
||||||
|
|
11
src/modal.c
11
src/modal.c
|
@ -291,7 +291,7 @@ main(int argc, char **argv)
|
||||||
return !printf("usage: modal [-vqn] source.modal\n");
|
return !printf("usage: modal [-vqn] source.modal\n");
|
||||||
for(i = 1; i < argc && *argv[i] == '-'; i++) {
|
for(i = 1; i < argc && *argv[i] == '-'; i++) {
|
||||||
switch(argv[i][1]) {
|
switch(argv[i][1]) {
|
||||||
case 'v': /* version */ return !printf("Modal Interpreter, 28 Apr 2024.\n");
|
case 'v': /* version */ return !printf("Modal Interpreter, 29 Apr 2024.\n");
|
||||||
case 'q': /* quiet */ quiet = 1; break;
|
case 'q': /* quiet */ quiet = 1; break;
|
||||||
case 'p': /* debug */ debug = 1; break;
|
case 'p': /* debug */ debug = 1; break;
|
||||||
case 'n': /* infinite */ cycles = 0xffffffff; break;
|
case 'n': /* infinite */ cycles = 0xffffffff; break;
|
||||||
|
@ -318,12 +318,15 @@ main(int argc, char **argv)
|
||||||
if(!cycles--) return !fprintf(stderr, "Modal rewrites exceeded.\n");
|
if(!cycles--) return !fprintf(stderr, "Modal rewrites exceeded.\n");
|
||||||
if(!quiet) {
|
if(!quiet) {
|
||||||
while(rules_-- > rules) {
|
while(rules_-- > rules) {
|
||||||
if(!rules_->refs && rules_->a)
|
if(rules_->a) {
|
||||||
|
if(!rules_->refs)
|
||||||
fprintf(stderr, "-- Unused rule: %d <> (%s) (%s)\n", rules_->id, rules_->a, rules_->b);
|
fprintf(stderr, "-- Unused rule: %d <> (%s) (%s)\n", rules_->id, rules_->a, rules_->b);
|
||||||
if(debug && rules_->a)
|
if(debug)
|
||||||
fprintf(stderr, " (%s) (%s), %d times.\n", rules_->a, rules_->b, rules_->refs);
|
fprintf(stderr, " (%s) (%s), %d times.\n", rules_->a, rules_->b, rules_->refs);
|
||||||
}
|
}
|
||||||
fprintf(stderr, ".. %s\nCompleted in %d rewrites.\n", src_, rw);
|
}
|
||||||
|
if(rw)
|
||||||
|
fprintf(stderr, "Completed in %d rewrites.\n", rw - 1);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue