/
lcf.xsd
222 lines (210 loc) · 8.84 KB
/
lcf.xsd
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<?xml version="1.0" encoding="utf-8"?>
<xsd:schema
xmlns:lcf="http://planet-sl.org/lcf"
xmlns:ldf="http://planet-sl.org/ldf"
targetNamespace="http://planet-sl.org/lcf"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:annotation>
<xsd:documentation>
LCF Configuration Format, where
LCI = Language Convergence Infrastructure
Part of SLPS = Software Language Processing Suite
</xsd:documentation>
</xsd:annotation>
<xsd:element name="configuration">
<xsd:complexType>
<xsd:sequence>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element name="shortcut" type="lcf:shortcutType" />
<xsd:element name="tool" type="lcf:toolType" />
<xsd:element name="action" type="lcf:actionType" />
<xsd:element name="source" type="lcf:sourceType" />
<xsd:element name="target" type="lcf:targetType" />
<xsd:element name="comment" type="lcf:mixedType" />
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="actionType">
<xsd:annotation>
<xsd:documentation>
An action in LCF is a transformation step.
Usually an action is defined as a reference to an XBGF file with a sequence of atomic grammar transformations
grouped by one theme.
Actions are combined in chains to get from sources and intermediate targets to one final target.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="comment" type="xsd:string" minOccurs="0"/>
<xsd:element name="name" type="xsd:string" maxOccurs="unbounded"/>
<xsd:element name="definition">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="command" type="lcf:commandtype" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="shortcutType">
<xsd:annotation>
<xsd:documentation>
An shortcut in LCF is just a simple macro.
If binds a longer definition to a concise name.
For example, a path with long directory names that is used multiple times in the LCF document is a good shortcut.
Shortcuts can be defined on basis of other shortcuts defined before them in the LCF file.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="definition">
<xsd:complexType mixed="true">
<xsd:group ref="lcf:expansion" minOccurs="0" maxOccurs="unbounded"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:group name="expansion">
<xsd:annotation>
<xsd:documentation>
An expand in LCF is a way to use macros.
The volatile expand references a user-defined shortcut.
The expand-action is substituted with a name of an action inside which it is used.
The expand-input is substituted with a name of the file that is the main input for the parser/evaluator.
The expand-output is substituted with a name of the file that is produced by the parser/evaluator.
The expand-context is substituted with a name of the file that contains a context for the evaluator.
The expand-yields is substituted with a value that the evaluator is expected to return.
For more information on sample-related matters, consult LDF schema.
</xsd:documentation>
</xsd:annotation>
<xsd:choice>
<xsd:element name="expand" type="xsd:string" />
<xsd:element name="expand-action">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-input">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-output">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-context">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-yields">
<xsd:complexType/>
</xsd:element>
</xsd:choice>
</xsd:group>
<xsd:complexType name="commandtype" mixed="true">
<xsd:annotation>
<xsd:documentation>
A command in LCF is something that is possible to run with a given shell.
If one needs to redirect the output stream (stdout), use the @out attribute.
If one needs to redirect the error stream (stderr), use the @err attribute.
</xsd:documentation>
</xsd:annotation>
<xsd:group ref="lcf:expansion" minOccurs="0" maxOccurs="unbounded"/>
<xsd:attribute name="err" type="xsd:string" use="optional" />
<xsd:attribute name="out" type="xsd:string" use="optional" />
</xsd:complexType>
<xsd:complexType name="sourceType">
<xsd:annotation>
<xsd:documentation>
A source in LCF is the starting point for the grammar convergence.
A source must have a name by which it will be referenced later.
A source must have a defined extractor that provides LCI with a BGF.
A source may have a parser and an evaluator defined as commands - if they are present, they will be tested.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element name="extractor">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name">
<xsd:complexType mixed="true">
<xsd:group ref="lcf:expansion" minOccurs="0" maxOccurs="unbounded"/>
</xsd:complexType>
</xsd:element>
<xsd:element name="arguments">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="argument">
<xsd:complexType mixed="true">
<xsd:group ref="lcf:expansion" minOccurs="0" maxOccurs="unbounded"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="parser" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="command" type="lcf:commandtype"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="evaluator" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="command" type="lcf:commandtype"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="targetType">
<xsd:annotation>
<xsd:documentation>
A target in LCF is the convergence point.
A target must have a name by which it is referenced and displayed on a diagram.
A target can have any number of branches.
Each branch defines an input that can be either source name or a target name.
Each branch also references a sequence of actions that are performed on that source or target to reach this target.
Once all branches are made, a diff tool is run to make sure all results converge.
If there is one branch, no diffing takes place.
If there are three or more branches, diffs occur pairwise.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" />
<xsd:element maxOccurs="unbounded" name="branch">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="input" type="xsd:string" />
<xsd:element name="perform" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="toolType">
<xsd:annotation>
<xsd:documentation>
A tool in LCF is an external script.
At this point there are three tools which output is needed by LCI:
The validator makes sure that the BGFs are valid against their schema.
This includes extracted BGFs as well as all derived BGFs.
If the validator is not defined, LCI works fine without it.
The diff tool takes two parameters and returns zero if both BGFs are deemed equal.
If the diff tool is not defined, LCI can only work with one-branch targets.
The testset generates a test set in LDF, presumably by taking it from a bigger LDF document.
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="lcf:Tools"/>
<xsd:element name="command" type="lcf:commandtype"/>
</xsd:sequence>
</xsd:complexType>
<xsd:simpleType name="Tools">
<xsd:restriction base="xsd:token">
<xsd:enumeration value="validator"/>
<xsd:enumeration value="diff"/>
<xsd:enumeration value="testset"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>