/usr/share/doc/frown-doc/examples/manual/RepMin.lg is in frown-doc 0.6.1-13.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | > module RepMin where
>
> data Tree a = Leaf a | Fork (Tree a) (Tree a)
> deriving (Show)
>
> data Terminal = Num Integer | LPar | RPar
>
> %{
>
> Terminal = Num {Integer}
> | LPar as "("
> | RPar as ")";
>
> Nonterminal = * start {Tree Integer}
> | expr {Integer -> (Tree Integer, Integer)};
>
> start { let (t, m) = f m in t }
> : expr {f};
>
> expr { \ m -> (Leaf m, i) }
> : Num {i};
> expr { \ m -> let { (tl, ml) = l m
> ; (tr, mr) = r m }
> in (Fork tl tr, ml `min` mr) }
> : expr {l}, "(", expr {r}, ")";
>
> }%
>
> frown ts = fail "syntax error"
|