-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTranslator.lhs
More file actions
74 lines (59 loc) · 1.91 KB
/
Copy pathTranslator.lhs
File metadata and controls
74 lines (59 loc) · 1.91 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
\documentclass{article}
%-------------------------------------------------------------------------------
% SETUP
%-------------------------------------------------------------------------------
\usepackage{verbatim}
\newenvironment{code}{\verbatim}{\endverbatim\normalsize}
\usepackage[margin=1in]{geometry}
\newcommand{\tc}[1]{\texttt{#1}}
%-------------------------------------------------------------------------------
\begin{document}
%-------------------------------------------------------------------------------
\begin{center}
\Huge{ATL Translator}
\\[0.75cm]
\end{center}
%///////////////////////////////////////////////
\begin{code}
module Translator
( SourceCode, TransCode, TargetCode
, Translator(Translator)
, trans_blocks
, trans_root_block
, trans_convert_filepath
, Block(Block)
, block_title
, block_children
, block_format
, block_does_nest
, BlockChild(ChildCode, ChildBlock)
) where
import Utilities
type SourceCode = String
type TransCode = String
type TargetCode = String
data Translator = Translator
{ trans_blocks :: [Block]
, trans_root_block :: Block
, trans_convert_filepath :: FilePath -> FilePath }
data Block = Block
{ block_title :: String
, block_children :: [BlockChild]
, block_format :: [TargetCode] -> TargetCode
, block_does_nest :: Bool }
data BlockChild
= ChildCode SourceCode
| ChildBlock Block
instance Show Block where
show block
= "{ " ++ (block_title block) ++ " : "
++ (show $ reverse $ map show $ block_children block) ++ " }"
instance Show BlockChild where
show child = case child of
ChildCode x -> x
ChildBlock x -> show x
\end{code}
%\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
%-------------------------------------------------------------------------------
\end{document}
%-------------------------------------------------------------------------------