Add Boucher's `lalr-scm' as the `(system base lalr)' module.
[bpt/guile.git] / test-suite / lalr / test-lr-basics-05.scm
CommitLineData
1b101522
LC
1;;; test-lr-basics-05.scm --
2;;
3;;A grammar accepting a sequence of equal tokens of arbitrary length.
4;;The return value is the list of values.
5;;
6
7(load "common-test.scm")
8
9(define (doit . tokens)
10 (let ((parser (lalr-parser (expect: 0)
11 (A)
12 (e (e A) : (cons $2 $1)
13 (A) : (list $1)
14 () : 0))))
15 (parser (make-lexer tokens) error-handler)))
16
17(check
18 (doit)
19 => 0)
20
21(check
22 (doit (make-lexical-token 'A #f 1))
23 => '(1))
24
25(check
26 (doit (make-lexical-token 'A #f 1)
27 (make-lexical-token 'A #f 2))
28 => '(2 1))
29
30(check
31 (doit (make-lexical-token 'A #f 1)
32 (make-lexical-token 'A #f 2)
33 (make-lexical-token 'A #f 3))
34 => '(3 2 1))
35
36;;; end of file