1 ;;; test-lr-basics-01.scm --
3 ;;A grammar that only accept a single terminal as input. It refuses the
4 ;;end-of-input as first token.
7 (load "common-test.scm")
9 (define (doit . tokens)
10 (let* ((lexer (make-lexer tokens))
11 (parser (lalr-parser (expect: 0)
15 (parser lexer error-handler)))
18 (doit (make-lexical-token 'A #f 1))
26 ;;Parse correctly the first A and reduce it. The second A triggers
27 ;;an error which empties the stack and consumes all the input
28 ;;tokens. Finally, an unexpected end-of-input error is returned
29 ;;because EOI is invalid as first token after the start.
30 (doit (make-lexical-token 'A #f 1)
31 (make-lexical-token 'A #f 2)
32 (make-lexical-token 'A #f 3))