Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/*
32
    TYPE ALGEBRA FOR TDF GENERATOR TOOL
33
 
34
    This algebra describes the types used by the TDF generator tool.
35
*/
36
 
37
ALGEBRA tdf:
38
 
39
 
40
/*
41
    PRIMITIVE TYPES
42
 
43
    The primitive types, from which everything else is built are integers
44
    and strings.
45
*/
46
 
47
int = "int" ;
48
unsigned = "unsigned" ;
49
string = "char *" ;
50
 
51
 
52
/*
53
    TYPE REPRESENTING A TDF CONSTRUCT PARAMETER
54
 
55
    A construct parameter consists of a parameter name and a parameter
56
    sort.  The brk and align arguments give alignment information.
57
*/
58
 
59
union PARAMETER (par) = {
60
    string name ;
61
    SORT type ;
62
    int brk ;
63
    int align ;
64
    int intro ;
65
} + {
66
    basic -> {
67
	/* empty */
68
    }
69
} ;
70
 
71
 
72
/*
73
    TYPE REPRESENTING A TDF CONSTRUCT
74
 
75
    A construct consists of a construct name, an encoding value, a result
76
    sort and a list of parameters.
77
*/
78
 
79
union CONSTRUCT (cons) = {
80
    string name ;
81
    unsigned encode ;
82
    SORT res ;
83
    LIST PARAMETER pars ;
84
    unsigned kind ;
85
} + {
86
    basic -> {
87
	/* empty */
88
    }
89
} ;
90
 
91
 
92
/*
93
    TYPE REPRESENTING A TDF SORT
94
 
95
    A sort is defined in two parts, a sort name and any associated sort
96
    information.  This is to allow sorts to be used before they are
97
    defined.  A sort can be a built-in sort (such as tdfstring), a basic
98
    sort consisting of a list of constructs, a dummy sort with only a
99
    single construct, a list sort, a simple list sort or an optional sort.
100
*/
101
 
102
union SORT_INFO (info) = {
103
    string name ;
104
} + {
105
    builtin -> {
106
	/* empty */
107
    },
108
    basic -> {
109
	unsigned bits ;
110
	unsigned extend ;
111
	unsigned max ;
112
	LIST CONSTRUCT cons ;
113
	CONSTRUCT sortname ;
114
    },
115
    dummy -> {
116
	CONSTRUCT cons ;
117
    },
118
    clist, slist, option -> {
119
	SORT arg ;
120
    }
121
} ;
122
 
123
union SORT (sort) = {
124
    string name ;
125
    string caps ;
126
    string link ;
127
    string unit ;
128
    int code ;
129
    int mark ;
130
    int special ;
131
    int edge ;
132
    SORT_INFO info ;
133
} + {
134
    basic -> {
135
	/* empty */
136
    }
137
} ;
138
 
139
 
140
/*
141
    TYPE REPRESENTING A TDF LINKAGE ITEM
142
 
143
    A linkage item consists of a sort and an associated linkage name.
144
*/
145
 
146
union LINKAGE (link) = {
147
    string name ;
148
    SORT type ;
149
} + {
150
    basic -> {
151
	/* empty */
152
    }
153
} ;
154
 
155
 
156
/*
157
    TYPE REPRESENTING THE TDF SPECIFICATION
158
 
159
    The specification consists of a version number, a list of sorts, plus
160
    lists of linkable entities.
161
*/
162
 
163
union SPECIFICATION (spec) = {
164
    unsigned major, minor ;
165
    LIST SORT sorts ;
166
    LIST LINKAGE vars ;
167
    LIST LINKAGE eqns ;
168
    LIST LINKAGE foreign ;
169
} + {
170
    basic -> {
171
	/* empty */
172
    }
173
} ;
174
 
175
 
176
/*
177
    COMMANDS
178
 
179
    A command for a template file consists of either a simple string,
180
    a list of commands, a conditional or a loop.
181
*/
182
 
183
union COMMAND (cmd) = {
184
    int line ;
185
} + {
186
    simple -> {
187
	string text ;
188
    },
189
    compound -> {
190
	LIST COMMAND seq ;
191
    },
192
    loop -> {
193
	string control ;
194
	COMMAND body ;
195
    },
196
    cond -> {
197
	string control ;
198
	COMMAND true_code ;
199
	COMMAND false_code ;
200
    },
201
    use -> {
202
	string sort ;
203
	string cons ;
204
    },
205
    special -> {
206
	string sort ;
207
	string cons ;
208
    }
209
} ;