Skip to content

Commit

Permalink
LCF upgrade, with comments!
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@139 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Aug 5, 2008
1 parent 855f49d commit 1ea0b20
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 55 deletions.
18 changes: 9 additions & 9 deletions shared/xsd/Makefile
Expand Up @@ -7,11 +7,11 @@ test:
make check

check:
make check1 arg=bgf.xsd
make check1 arg=xbgf.xsd
make check1 arg=xbgf.xsd
make check1 arg=btf.xsd
make check1 arg=ldf.xsd
@make check1 arg=bgf.xsd
@make check1 arg=xbgf.xsd
@make check1 arg=xbgf.xsd
@make check1 arg=btf.xsd
@make check1 arg=ldf.xsd

check-old:
@for file in *.xsd ; \
Expand All @@ -23,10 +23,10 @@ check-old:
done

check1:
echo Validating $$arg ... ; \
java -jar ${validator} $$arg ; \
echo Translating $$arg to BGF ... ; \
${viewer} $$arg > /dev/null ;\
@echo Validating $$arg ...
@java -jar ${validator} $$arg
@echo Translating $$arg to BGF ...
@${viewer} $$arg > /dev/null

clean:
rm -rf bin obj
Expand Down
166 changes: 120 additions & 46 deletions shared/xsd/lcf.xsd
Expand Up @@ -11,6 +11,8 @@
<xsd:documentation>
LCF Configuration Format, where
LCI = Language Convergence Infrastructure

Part of SLPS = Software Language Processing Suite
</xsd:documentation>
</xsd:annotation>

Expand All @@ -19,6 +21,7 @@
<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" />
Expand All @@ -29,6 +32,14 @@
</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"/>
Expand All @@ -43,76 +54,101 @@
</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:group ref="lcf:expansion" minOccurs="0" maxOccurs="unbounded"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:group name="expansion">
<xsd:choice>
<xsd:element name="expand" type="xsd:string" />
<xsd:element name="expand-type">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-arguments">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-source">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-action">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-first">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-second">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-context">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-sample">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-parsed">
<xsd:complexType/>
</xsd:element>
<xsd:element name="expand-yields">
<xsd:complexType/>
</xsd:element>
</xsd:choice>
<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" type="xsd:string"/>
<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: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>
Expand All @@ -134,6 +170,18 @@
</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">
Expand All @@ -147,4 +195,30 @@
</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>

0 comments on commit 1ea0b20

Please sign in to comment.