File: AGExampleIn.lhs

package info (click to toggle)
lhs2tex 1.9-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,544 kB
  • ctags: 28
  • sloc: haskell: 3,364; sh: 2,773; makefile: 349
file content (28 lines) | stat: -rw-r--r-- 765 bytes parent folder | download
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
%include verbatim.fmt
\begingroup
\let\origtt=\tt
%\let\small\scriptsize
\def\tt#1#2{\origtt\makebox[0pt]{\phantom{X}}}

>%format ^  = " "
>%format ^^ = "\;"
>%format ATTR = "\mathbf{ATTR}"
>%format SEM  = "\mathbf{SEM}"
>%format lhs  = "\mathbf{lhs}"
>%format .  = "."
>%format *  = "\times "
>\begin{code}
>ATTR Expr Factor  [ ^^ | ^^ | numvars   : Int  ]
>ATTR Expr Factor  [ ^^ | ^^ | value     : Int  ]
>
>SEM Expr
>  |  Sum       
>              lhs   .  value     =  @left.value    +  @right.value
>                    .  numvars   =  @left.numvars  +  @right.numvars
>SEM Factor
>  |  Prod      
>              lhs   .  value     =  @left.value    *  @right.value
>                    .  numvars   =  @left.numvars  +  @right.numvars
>\end{code}

\endgroup