/usr/share/doc/frown-doc/examples/manual/MCalc.lg is in frown-doc 0.6.1-14.
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 30 31 32 33 34 35 36 37 38 39 40 41 42 | %if False
> module MCalc where
> import Lexer
%endif
> trace :: Op -> (Int -> Int -> IO Int)
> trace op v1 v2 = putStrLn s >> return v
> where v = app op v1 v2
> s = show v1 ++ name op ++ show v2 ++ "=" ++ show v
%if False
> %{
>
> Terminal = Numeral {Int}
> | Addop {Op}
> | Mulop {Op}
> | LParen as "("
> | RParen as ")";
>
> Nonterminal = expr {Int}
> | term {Int}
> | factor {Int};
%endif
> expr {% trace op v1 v2} : expr {v1}, Addop {op}, term {v2};
> term {% trace op v1 v2} : term {v1}, Mulop {op}, factor {v2};
%if False
> expr {e} : term {e};
> term {e} : factor {e};
> factor {e} : "(", expr {e}, ")";
> {n} | Numeral {n};
> }%
>
> frown _ = fail "syntax error"
%endif
|