Reach pattern-matching.

This commit is contained in:
Dmitry Boulytchev 2018-05-02 22:36:27 +03:00
parent 40afee26cc
commit de17bdc3c4
6 changed files with 132 additions and 16 deletions

View file

@ -7,9 +7,9 @@ RC=../src/rc.opt
check: $(TESTS)
$(TESTS): %: %.expr
@$(RC) $< && cat $@.input | ./$@ > $@.log && diff $@.log orig/$@.log
#@$(RC) $< && cat $@.input | ./$@ > $@.log && diff $@.log orig/$@.log
cat $@.input | $(RC) -i $< > $@.log && diff $@.log orig/$@.log
cat $@.input | $(RC) -s $< > $@.log && diff $@.log orig/$@.log
#cat $@.input | $(RC) -s $< > $@.log && diff $@.log orig/$@.log
clean:
rm -f test*.log *.s *~ $(TESTS)

View file

@ -0,0 +1,12 @@
> 1
2
3
4
1
2
3
4
3
4
1
2

24
regression/test038.expr Normal file
View file

@ -0,0 +1,24 @@
fun append (x, y) {
case x of
`nil -> return y
| `cons (h, t) -> return `cons (h, append (t, y))
esac
}
fun printList (x) {
case x of
`nil -> skip
| `cons (h, t) -> write (h); printList (t)
esac
}
n := read ();
x := `cons (1, `cons (2, `nil));
y := `cons (3, `cons (4, `nil));
printList (x);
printList (y);
printList (append (x, y));
printList (append (y, x))

1
regression/test038.input Normal file
View file

@ -0,0 +1 @@
0