aboutsummaryrefslogtreecommitdiff
path: root/tree.icl
blob: e2524a96fdebce281ce52886fef809b450d0d881 (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-ward.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 = [Lit "xy"] } listIO)

	readFile :: !*File -> *(!String, !*File)
	readFile f
		# (end,f) = fend f
		| end     = ("", f)
		# (s,f)   = freadline f
		# (ss,f)  = readFile f
		= (s +++ ss, f)