File: LA.g

package info (click to toggle)
frown 0.6.1-14
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,956 kB
  • ctags: 271
  • sloc: haskell: 35,132; makefile: 228; csh: 35; yacc: 23
file content (41 lines) | stat: -rw-r--r-- 684 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{-

This example demonstrates that the computation of the look-ahead
information must use a stack of transitions (rather than a single
transition). If we have several epsilon-reductions in a row, we must
be able to backtrack to the original state.

	frown LA.g

-}

module LA
where

type Terminal                   =  Char

type Result                     =  []

%{

Terminal                        =  'a' | 'b' | 'c' | 'x' | 'y';
Nonterminal                     =   s  |  a  |  b | c | e1 | e2;

s  : 'a', a, 'x';
   | 'a', c, 'y';
   | 'b', a, 'y';
   | 'b', c, 'x';

a  : b, e1, e2;

b  : 'c';

c  : 'c';

e1 : ;

e2 : ;

}%

frown ts                        =  fail "syntax error"