blob: f895c89b7d21e8fbcf119aa09d3650cf2d2a3884 (
plain) (
blame)
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
|
module tree
import StdEnv, StdDebug
import Data.Maybe, Data.List
from Data.Func import $
import System.CommandLine, System.GetOpt
import Smurf
import SmurfParse
import LaTeX
Start w
# (_,f,w) = fopen "reverse.smf" FReadText w
# (pgm,f) = readFile f
# (ok,w) = fclose f w
# (Just pgm) = parse [c \\ c <-: pgm]
# tree = devtree pgm
# tree = trace (toString tree +++ "\n") tree
= toString (toLaTeX tree)
where
devtree pgm = fromJust (tree pgm zero { zero & input = [""] } listIO)
readFile :: !*File -> *(!String, !*File)
readFile f
# (end,f) = fend f
| end = ("", f)
# (s,f) = freadline f
# (ss,f) = readFile f
= (s +++ ss, f)
|