Skip to content

Commit

Permalink
test suite beautification; Languedoc progress
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@574 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Apr 9, 2009
1 parent d5cb655 commit 16ae92e
Show file tree
Hide file tree
Showing 28 changed files with 405 additions and 264 deletions.
53 changes: 28 additions & 25 deletions shared/xsd/xbgf.xsd
Expand Up @@ -470,11 +470,11 @@
<xsd:annotation>
<xsd:documentation>
An unused definition (at most used within the definition itself)
is removed. The undefine operator should be used instead when
the definition must be remove despite remaining uses. The
remove operator should be used instead when only part of the
definition (i.e., a production of a vertical definition) is
to be removed.
is removed. The <ldf:keyword>undefine</ldf:keyword> operator
should be utilised instead when the definition must be removed despite
remaining uses. The <ldf:keyword>remove</ldf:keyword> operator
should be utilised instead when only part of the definition (i.e.,
a production of a vertical definition) is to be removed.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
Expand Down Expand Up @@ -537,16 +537,17 @@
<xsd:documentation>
Folding replaces every expression that matches with the right hand
side of the given nonterminal's definition with the nonterminal
itself. As with unfold, fold works on the scope of the grammar,
but its impact can be limited to one labelled production or to
itself. As with <ldf:keyword>unfold</ldf:keyword>,
<ldf:keyword>fold</ldf:keyword> works on the scope of the grammar,
and its impact can be limited to one labelled production or to
all the productions belonging to one nonterminal. Regardless
of the specified scope, folding is not applied to the definition
of the argument nonterminal.
</xsd:documentation>
<xsd:documentation>
Since this transformation strives to preserve the language, it needs
a horisontal definition to work. When only one of several existing
definitions is used for folding, it actually increases the semantics
definitions is used for folding, it would actually increase the semantics
of the language after transformation---the corresponding XBGF command
is called <ldf:keyword>upgrade</ldf:keyword>.
</xsd:documentation>
Expand Down Expand Up @@ -606,11 +607,11 @@
<xsd:element name="introduce">
<xsd:annotation>
<xsd:documentation>
A definition of a fresh nonterminal is added. The add operator
should be used instead, if the nonterminal is already defined,
is to be merely extended. The define operator should be used
instead, if the nonterminal is readily in use, but merely lacks
a definition.
A definition of a fresh nonterminal is added. The <ldf:keyword>add</ldf:keyword>
operator should be used instead, if the nonterminal is already defined,
is to be merely extended. The <ldf:keyword>define</ldf:keyword> operator
should be used instead, if the nonterminal is readily in use, but merely
lacks a definition.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
Expand Down Expand Up @@ -925,7 +926,8 @@
<xsd:element name="detour">
<xsd:annotation>
<xsd:documentation>
A reverse of abridge that can introduce a reflexive chain production.
A reverse of <ldf:keyword>abridge</ldf:keyword> that can introduce
a reflexive chain production.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
Expand Down Expand Up @@ -1058,7 +1060,7 @@
<xsd:element name="unfold">
<xsd:annotation>
<xsd:documentation>
The most basic unfolding transformation searches for all the instances
The most basic unfolding transformation searches the scope for all the instances
of the given nonterminal usage and replaces such occurrences with the
defining expression of that nonterminal. By default the scope of the
transformation is the full grammar, but it can be limited to all the
Expand All @@ -1067,9 +1069,9 @@
of the argument nonterminal.
</xsd:documentation>
<xsd:documentation>
The definition that is being unfolded is assumed to be horisontal
(see the section on refactorings for more information about horisontal
and vertical definitions).
The definition that is being unfolded is assumed to be horisontal,
i.e. to consist of one single production. See the section on refactorings
for more information about horisontal and vertical definitions.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
Expand Down Expand Up @@ -1170,16 +1172,17 @@
<xsd:element name="yaccify">
<xsd:annotation>
<xsd:documentation>
This transformation is the reverse of deyaccify. The productions provided
as arguments must be yaccified with respect to the actual content of the
grammar. If the deyaccification process on them is successful and yields
the production that can be found in the grammar, it is removed and replaced
by these simpler definitions of an optional
This transformation is the reverse of <ldf:keyword>deyaccify</ldf:keyword>.
The productions provided as arguments must be yaccified with respect to the
actual content of the grammar. If the deyaccification process on them is
successful and yields the production that can be found in the grammar, it
is removed and replaced by these simpler definitions of an optional
or repeating nonterminal, given in BNF-only expressiveness.
</xsd:documentation>
<xsd:documentation>
Some complex yaccify cases require prior use of extract for introduction of
an nonterminal for the optional or repeating phrase.
Some complex <ldf:keyword>yaccify</ldf:keyword> cases require prior
use of extract for introduction of an nonterminal for the optional
or repeating phrase.
</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
Expand Down
42 changes: 40 additions & 2 deletions shared/xsl/ldf2tex.xslt
Expand Up @@ -19,6 +19,7 @@
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}
\usepackage{listings}
\usepackage{graphicx}
\lstdefinelanguage{pp}{%
numbers=none,
literate={EPSILON}{{$\varepsilon$}}1 %{STRING}{{$\lambda$}}1
Expand Down Expand Up @@ -386,10 +387,47 @@
</xsl:text>
</xsl:template>

<!--
\begin{figure}[t!]
\begin{center}
\includegraphics[width=0.85\textwidth]{convtree_jls_s.pdf}
\end{center}
\icaption{Convergence tree for the JLS grammars.}
\label{F:jls-less}
\end{figure}
-->
<xsl:template match="figure">
<xsl:text>
\begin{figure}\begin{center}
</xsl:text>
<xsl:choose>
<xsl:when test="type = 'PDF'">
<xsl:text>\includegraphics[width=0.5\textwidth]{</xsl:text>
<xsl:value-of select="file"/>
<xsl:text>}</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>...don't know how to insert a figure...</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>\end{center}\caption{</xsl:text>
<xsl:value-of select="caption"/>
<xsl:text>}</xsl:text>
<xsl:if test="@id">
<xsl:text>\caption{</xsl:text>
<xsl:value-of select="@id"/>
<xsl:text>}</xsl:text>
</xsl:if>
<xsl:text>\end{figure}

</xsl:text>
</xsl:template>

<xsl:template match="table">
<xsl:text>
\begin{center}\begin{tabular}{</xsl:text>
<xsl:for-each select="./row[1]/cell">
\begin{center}\begin{tabular}{c|</xsl:text>
<xsl:for-each select="./row[1]/cell[position()>1]">
<xsl:text>c</xsl:text>
</xsl:for-each>
<xsl:text>}</xsl:text>
Expand Down
9 changes: 4 additions & 5 deletions topics/languedoc/xbgf/Makefile
Expand Up @@ -2,17 +2,17 @@ validator = ../../../shared/tools/checkxml
xldf = ../../../shared/tools/xldf
xbgf = ../../../shared/tools/xbgf

build: architecture_large.pdf
build: bnfbgf.pdf
../../../shared/tools/xsd2bgf ../../../shared/xsd/xbgf.xsd xbgf.bgf
../../../topics/extraction/xsd2ldf/ldfgen.py ../../../shared/xsd/xbgf.xsd xbgf.bgf xbgf.ldf
${xldf} xbgf.xldf xbgf.ldf xbgf_ready.ldf
xsltproc ../../../shared/xsl/ldf2tex.xslt xbgf_ready.ldf > xbgf.tex
pdflatex -interaction=batchmode xbgf
pdflatex -interaction=batchmode xbgf

architecture_large.pdf:
bnfbgf.pdf:
cd ../../presentation/prettyprint ; make
cp ../../presentation/prettyprint/architecture_large.pdf .
cp ../../presentation/prettyprint/architecture_large.pdf bnfbgf.pdf

rebuild:
make clean
Expand All @@ -21,8 +21,7 @@ rebuild:
clean:
rm -f xbgf*.bgf xbgf*.ldf xbgf.html xbgf.fo xbgf.pdf *.xbnf
rm -f bgf*.bgf ldf*.bgf ldf*.ldf ldf.fo ldf.pdf xldf-tmp*
rm -f *.aux *.log *.toc *.tex printed_for_xldf.tmp
rm -f architecture_large.pdf
rm -f *.aux *.log *.toc *.tex printed_for_xldf.tmp bnfbgf.pdf

check:
ls -1 *.xbgf | xargs -n1 ${validator} xbgf
Expand Down
2 changes: 1 addition & 1 deletion topics/languedoc/xbgf/xldf/completeDecorSection.xldf
Expand Up @@ -54,7 +54,7 @@
if executed on the same grammar, would produce a selector-free
yet structurally equivalent grammar. We used such a generator
called strips in the FL case study as the final stage to converge
the abstract syntax (with selectors) with the concrte syntax (with
the abstract syntax (with selectors) with the concrete syntax (with
terminals).
</text>
</content>
Expand Down
90 changes: 48 additions & 42 deletions topics/languedoc/xbgf/xldf/completeFoldSection.xldf
Expand Up @@ -6,42 +6,6 @@
xmlns:xldf="http://planet-sl.org/xldf">

<!-- beautify xbgf -->
<xldf:transform-grammar>
<target>element-fold</target>
<xbgf:anonymize>
<bgf:production>
<nonterminal>fold</nonterminal>
<bgf:expression>
<sequence>
<bgf:expression>
<marked>
<bgf:expression>
<selectable>
<selector>nonterminal</selector>
<bgf:expression>
<nonterminal>nonterminal</nonterminal>
</bgf:expression>
</selectable>
</bgf:expression>
</marked>
</bgf:expression>
<bgf:expression>
<optional>
<bgf:expression>
<selectable>
<selector>in</selector>
<bgf:expression>
<nonterminal>scope</nonterminal>
</bgf:expression>
</selectable>
</bgf:expression>
</optional>
</bgf:expression>
</sequence>
</bgf:expression>
</bgf:production>
</xbgf:anonymize>
</xldf:transform-grammar>
<xldf:transform-grammar>
<target>element-unfold</target>
<xbgf:anonymize>
Expand Down Expand Up @@ -93,9 +57,9 @@
<xldf:insert>
<before>
<text>
The definition that is being unfolded is assumed to be horisontal
(see the section on refactorings for more information about horisontal
and vertical definitions).
The definition that is being unfolded is assumed to be horisontal,
i.e. to consist of one single production. See the section on refactorings
for more information about horisontal and vertical definitions.
</text>
</before>
<content>
Expand Down Expand Up @@ -148,6 +112,44 @@
<file>../../transformation/xbgf/tests/unfold.baseline</file>
</xldf:import-grammar>

<!-- beautify xbgf -->
<xldf:transform-grammar>
<target>element-fold</target>
<xbgf:anonymize>
<bgf:production>
<nonterminal>fold</nonterminal>
<bgf:expression>
<sequence>
<bgf:expression>
<marked>
<bgf:expression>
<selectable>
<selector>nonterminal</selector>
<bgf:expression>
<nonterminal>nonterminal</nonterminal>
</bgf:expression>
</selectable>
</bgf:expression>
</marked>
</bgf:expression>
<bgf:expression>
<optional>
<bgf:expression>
<selectable>
<selector>in</selector>
<bgf:expression>
<nonterminal>scope</nonterminal>
</bgf:expression>
</selectable>
</bgf:expression>
</optional>
</bgf:expression>
</sequence>
</bgf:expression>
</bgf:production>
</xbgf:anonymize>
</xldf:transform-grammar>

<xldf:place>
<section>element-fold</section>
<inside>group-folding-transformation</inside>
Expand Down Expand Up @@ -195,7 +197,7 @@
<content>
<text>
The <ldf:keyword>inline</ldf:keyword> transformation is by far the
most used in Java Language Specification case. One of the reasons
most used in Java Language Specification case study. One of the reasons
is what we call layering: in particular expressions and statements
are introduced in the $G_j^R$ with a set of related nonterminals:
LabeledStatement, IfThenElseStatement, WhileStatement, ForStatement, etc, and
Expand Down Expand Up @@ -369,7 +371,9 @@
<content>
<text>
In the same way it was removed in the previous example,
the bracketing production can be added to the grammar:
the bracketing production can be added to the grammar.
The transformation that reverts the impact of the previous
<ldf:keyword>abridge</ldf:keyword>, looks like this:
</text>
</content>
</example>
Expand Down Expand Up @@ -446,7 +450,9 @@
<content>
<text>
In the same way it was removed in the previous example,
the chain production can be added to the grammar:
the chain production can be added to the grammar.
The transformation that reverts the impact of the previous
<ldf:keyword>unchain</ldf:keyword>, looks like this:
</text>
</content>
</example>
Expand Down
30 changes: 15 additions & 15 deletions topics/languedoc/xbgf/xldf/completeIntro.xldf
Expand Up @@ -364,6 +364,20 @@
<prettyprinter>../../../shared/tools/xbgf2xbnf</prettyprinter>
</xldf:import-sample>

<xldf:add-figure>
<figure>
<caption>
Full convergence diagram for BNF and BGF. The top nodes are sources, the bottom node
is the target, the arc labels are separate XBGF scripts, the nodes contain
numbers of name mismatches and structural mismatches between each step and
the synch point (marked as a double circle).
</caption>
<type>PDF</type>
<file>bnfbgf.pdf</file>
</figure>
<to>compatibility-section</to>
</xldf:add-figure>

<xldf:append>
<where>compatibility-section</where>
<content>
Expand All @@ -386,20 +400,6 @@
<prettyprinter>../../../shared/tools/xbgf2xbnf</prettyprinter>
</xldf:import-sample>

<xldf:add-figure>
<figure>
<caption>
Full convergence diagram for BNF and BGF. The top nodes are sources, the bottom node
is the target, the arc labels are separate XBGF scripts, the nodes contain
numbers of name mismatches and structural mismatches between each step and
the synch point (marked as a double circle).
</caption>
<type>PDF</type>
<file>architecture_large.pdf</file>
</figure>
<to>compatibility-section</to>
</xldf:add-figure>

<xldf:append>
<where>compatibility-section</where>
<content>
Expand Down Expand Up @@ -476,4 +476,4 @@
<msup><mi>x</mi><mo>^\star</mo></msup>
</mrow>
</mml:math>-->
</xldf:sequence>
</xldf:sequence>

0 comments on commit 16ae92e

Please sign in to comment.