Skip to content

Commit

Permalink
BGF for BNF; convergence for BGF and BNF; Languedoc progress
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@494 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Feb 25, 2009
1 parent c40106c commit 4038079
Show file tree
Hide file tree
Showing 18 changed files with 1,358 additions and 339 deletions.
94 changes: 48 additions & 46 deletions shared/xsd/ldf.xsd
Expand Up @@ -116,7 +116,7 @@
</xsd:choice>
</xsd:group>

<xsd:group name="lexicalGroup">
<xsd:group name="lexical">
<xsd:annotation>
<xsd:documentation>
Sections describing lexical structure tend to be shorter, less structured inside,
Expand Down Expand Up @@ -208,13 +208,24 @@
<xsd:element name="frontMatter">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="ldf:front-simple-sections" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:group ref="ldf:front-simple-section" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="lists" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="ldf:front-list" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="lexicalPart" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
<xsd:group ref="ldf:lexical" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="lists" type="ldf:frontLists" minOccurs="0"/>

<xsd:element name="lexicalPart" type="ldf:lexical" minOccurs="0"/>

<xsd:element name="core" type="ldf:StructuredSection" maxOccurs="unbounded"/>
<xsd:element name="annex" type="ldf:StructuredSection" minOccurs="0" maxOccurs="unbounded"/>
Expand Down Expand Up @@ -244,7 +255,7 @@
</xsd:sequence>
</xsd:complexType>

<xsd:group name="front-simple-sections">
<xsd:group name="front-simple-section">
<xsd:choice>
<xsd:element name="foreword" type="ldf:SimpleSection">
<xsd:annotation>
Expand Down Expand Up @@ -353,46 +364,37 @@
</xsd:choice>
</xsd:group>

<xsd:complexType name="frontLists">
<xsd:sequence minOccurs="0">
<xsd:choice maxOccurs="unbounded">
<xsd:element name="definitions" type="ldf:ListOfTerms">
<xsd:annotation>
<xsd:documentation>
This is a list of definitions for all basic terms needed to understand the document,
but not especially introduced in it. Typical examples include explaining what is
a "program", what is a "namespace", what is a "library", what is "behaviour".
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="abbreviations" type="ldf:ListOfTerms">
<xsd:annotation>
<xsd:documentation>
Acronyms like IEEE, ISO or like CLI, BCL are frequently defined here in a separate definition list.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="languageOverview" type="ldf:ListOfTerms">
<xsd:annotation>
<xsd:documentation>
Such an informal introduction to the language is not present in all standards.
However, some specifications contain a not claimed to be complete list of
language concepts with their definitions and perhaps even some examples.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="lexical">
<xsd:sequence>
<xsd:group ref="ldf:lexicalGroup" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

<xsd:group name="front-list">
<xsd:choice>
<xsd:element name="definitions" type="ldf:ListOfTerms">
<xsd:annotation>
<xsd:documentation>
This is a list of definitions for all basic terms needed to understand the document,
but not especially introduced in it. Typical examples include explaining what is
a "program", what is a "namespace", what is a "library", what is "behaviour".
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="abbreviations" type="ldf:ListOfTerms">
<xsd:annotation>
<xsd:documentation>
Acronyms like IEEE, ISO or like CLI, BCL are frequently defined here in a separate definition list.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element name="languageOverview" type="ldf:ListOfTerms">
<xsd:annotation>
<xsd:documentation>
Such an informal introduction to the language is not present in all standards.
However, some specifications contain a not claimed to be complete list of
language concepts with their definitions and perhaps even some examples.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:choice>
</xsd:group>

<!--xsd:complexType name="contentType">
<!--xsd:complexType name="contentType">
<xsd:annotation>
<xsd:documentation>
A sections content is a list of different kinds of portions.
Expand Down
32 changes: 29 additions & 3 deletions shared/xsd/xldf.xsd
Expand Up @@ -35,6 +35,7 @@
</xsd:annotation>
<xsd:choice>
<xsd:element ref="xldf:insert"/>
<xsd:element ref="xldf:import"/>
<xsd:element ref="xldf:move"/>
<xsd:element ref="xldf:rename"/>
<xsd:element ref="xldf:append"/>
Expand Down Expand Up @@ -75,9 +76,9 @@
</xsd:annotation>
<xsd:complexType>
<xsd:choice>
<xsd:element name="front" type="ldf:frontMatter"/>
<xsd:element name="list" type="ldf:frontLists"/>
<xsd:element name="lexical" type="ldf:lexical"/>
<xsd:group ref="ldf:front-simple-section"/>
<xsd:group ref="ldf:front-list"/>
<xsd:group ref="ldf:lexical"/>
<xsd:element name="core" type="ldf:StructuredSection"/>
</xsd:choice>
</xsd:complexType>
Expand Down Expand Up @@ -132,6 +133,31 @@
</xsd:complexType>
</xsd:element>

<xsd:element name="import">
<xsd:annotation>
<xsd:documentation>
Deprecated
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="target" type="xsd:string"/> <!-- IDREF -->
<xsd:element name="file" type="xsd:string"/> <!-- IDREF -->
</xsd:sequence>
</xsd:complexType>
</xsd:element>

<xsd:element name="transform-grammar">
<xsd:annotation>
<xsd:documentation>
Deprecated
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:group ref="xbgf:transformation"/>
</xsd:complexType>
</xsd:element>

<xsd:group name="scope">
<xsd:annotation>
<xsd:documentation>
Expand Down
64 changes: 44 additions & 20 deletions shared/xsl/ldf2tex.xslt
Expand Up @@ -179,9 +179,33 @@
<xsl:value-of select="$target/title"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="capitalise">
<xsl:with-param name="section" select="$target"/>
</xsl:call-template>
<xsl:choose>
<!-- can be replaced with a unified CamelCase2Whitespace -->
<xsl:when test="local-name() = 'lineContinuations'">
<xsl:text>Line continuations</xsl:text>
</xsl:when>
<xsl:when test="local-name() = 'designGoals'">
<xsl:text>Design goals</xsl:text>
</xsl:when>
<xsl:when test="local-name() = 'normativeReferences'">
<xsl:text>Normative references</xsl:text>
</xsl:when>
<xsl:when test="local-name() = 'documentStructure'">
<xsl:text>Document structure</xsl:text>
</xsl:when>
<xsl:when test="local-name() = 'whatsnew'">
<xsl:text>What's new</xsl:text>
</xsl:when>
<xsl:when test="local-name() = 'languageOverview'">
<xsl:text>Language overview</xsl:text>
</xsl:when>
<!-- end of CamelCase2Whitespace -->
<xsl:otherwise>
<xsl:call-template name="capitalise">
<xsl:with-param name="section" select="$target"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:text>}</xsl:text>
Expand Down Expand Up @@ -221,26 +245,26 @@
<xsl:param name="section"/>
<xsl:for-each select="$section/*">
<xsl:choose>
<xsl:when test="local-name() = 'id'">
<xsl:text>\label{</xsl:text>
<xsl:value-of select="."/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="local-name() = 'title'"/>
<xsl:when test="local-name() = 'author'"/>
<xsl:when test="local-name() = 'production'">
<xsl:text>
<xsl:when test="local-name() = 'id'">
<xsl:text>\label{</xsl:text>
<xsl:value-of select="."/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:when test="local-name() = 'title'"/>
<xsl:when test="local-name() = 'author'"/>
<xsl:when test="local-name() = 'production'">
<xsl:text>
\begin{verbatim}</xsl:text>
<xsl:apply-templates select="."/>
<xsl:text>\end{verbatim}
<xsl:apply-templates select="."/>
<xsl:text>\end{verbatim}

</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="process-text">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:otherwise>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="process-text">
<xsl:with-param name="text" select="."/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:template>
Expand Down
6 changes: 4 additions & 2 deletions topics/languedoc/Makefile
Expand Up @@ -16,7 +16,9 @@ xbgf:

tex:
../../shared/tools/xsd2bgf ../../shared/xsd/xbgf.xsd xbgf.bgf
../../shared/tools/xbgf beautify.xbgf xbgf.bgf xbgf_1.bgf
../../shared/tools/xsd2bgf ../../shared/xsd/bgf.xsd bgf.bgf
../../shared/tools/xbgf beautify_xbgf.xbgf xbgf.bgf xbgf_1.bgf
../../shared/tools/xbgf beautify_bgf.xbgf bgf.bgf bgf_pretty.bgf
../../topics/extraction/xsd2ldf/ldfgen.py ../../shared/xsd/xbgf.xsd xbgf_1.bgf xbgf.ldf
python ../../topics/transformation/xldf/xldf.py complete.xldf xbgf.ldf xbgf_1.ldf
xsltproc ../../shared/xsl/ldf2tex.xslt xbgf_1.ldf > xbgf.tex
Expand All @@ -25,6 +27,6 @@ tex:

clean:
rm -f xbgf*.bgf xbgf*.ldf xbgf.html xbgf.fo xbgf.pdf
rm -f ldf*.bgf ldf*.ldf ldf.fo ldf.pdf
rm -f bgf*.bgf ldf*.bgf ldf*.ldf ldf.fo ldf.pdf
rm -f *.aux *.log *.toc *.tex

118 changes: 118 additions & 0 deletions topics/languedoc/beautify_bgf.xbgf
@@ -0,0 +1,118 @@
<?xml version="1.0" encoding="utf-8"?>
<xbgf:sequence
xmlns:bgf="http://planet-sl.org/bgf"
xmlns:xbgf="http://planet-sl.org/xbgf">

<xbgf:anonymize>
<bgf:production>
<nonterminal>production</nonterminal>
<bgf:expression>
<sequence>
<bgf:expression>
<optional>
<bgf:expression>
<marked>
<bgf:expression>
<selectable>
<selector>label</selector>
<bgf:expression>
<nonterminal>label</nonterminal>
</bgf:expression>
</selectable>
</bgf:expression>
</marked>
</bgf:expression>
</optional>
</bgf:expression>
<bgf:expression>
<selectable>
<selector>nonterminal</selector>
<bgf:expression>
<nonterminal>nonterminal</nonterminal>
</bgf:expression>
</selectable>
</bgf:expression>
<bgf:expression>
<nonterminal>expression</nonterminal>
</bgf:expression>
</sequence>
</bgf:expression>
</bgf:production>
</xbgf:anonymize>
<xbgf:anonymize>
<bgf:production>
<nonterminal>production</nonterminal>
<bgf:expression>
<sequence>
<bgf:expression>
<optional>
<bgf:expression>
<nonterminal>label</nonterminal>
</bgf:expression>
</optional>
</bgf:expression>
<bgf:expression>
<marked>
<bgf:expression>
<selectable>
<selector>nonterminal</selector>
<bgf:expression>
<nonterminal>nonterminal</nonterminal>
</bgf:expression>
</selectable>
</bgf:expression>
</marked>
</bgf:expression>
<bgf:expression>
<nonterminal>expression</nonterminal>
</bgf:expression>
</sequence>
</bgf:expression>
</bgf:production>
</xbgf:anonymize>

<xbgf:vertical>
<nonterminal>expression</nonterminal>
</xbgf:vertical>
<xbgf:unlabel>
<label>value</label>
</xbgf:unlabel>
<xbgf:unlabel>
<label>terminal</label>
</xbgf:unlabel>
<xbgf:unlabel>
<label>nonterminal</label>
</xbgf:unlabel>
<xbgf:anonymize>
<bgf:production>
<label>selectable</label>
<nonterminal>expression</nonterminal>
<bgf:expression>
<sequence>
<bgf:expression>
<marked>
<bgf:expression>
<selectable>
<selector>selector</selector>
<bgf:expression>
<nonterminal>selector</nonterminal>
</bgf:expression>
</selectable>
</bgf:expression>
</marked>
</bgf:expression>
<bgf:expression>
<nonterminal>expression</nonterminal>
</bgf:expression>
</sequence>
</bgf:expression>
</bgf:production>
</xbgf:anonymize>
<xbgf:horizontal>expression</xbgf:horizontal>

<xbgf:undefine>label</xbgf:undefine>
<xbgf:undefine>nonterminal</xbgf:undefine>
<xbgf:undefine>terminal</xbgf:undefine>
<xbgf:undefine>selector</xbgf:undefine>

</xbgf:sequence>
File renamed without changes.

0 comments on commit 4038079

Please sign in to comment.