Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding new tools and pimping old ones
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@1166 ab42f6e0-554d-0410-b580-99e487e6eeb2
- Loading branch information
1 parent
a597e36
commit 9b33f7a
Showing
7 changed files
with
113 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
LOCAL=${PWD} | ||
cd `dirname $0` | ||
cd ../.. | ||
SLPS=${PWD} | ||
cd ${LOCAL} | ||
|
||
if [ $# -eq 1 ]; then | ||
OUTPUT=/dev/stdout | ||
elif [ $# -ne 2 ]; then | ||
echo "This tool pretty-prints production rules of the root nonterminals." | ||
echo "Usage: showrootprods <input-bgf-document> [<output-text>]" | ||
echo "When output file is not specified, stdout is used." | ||
exit 1 | ||
elif [ ! -r $1 ]; then | ||
echo "Oops: $1 not found or not readable." | ||
exit 1 | ||
else | ||
OUTPUT=$2 | ||
fi | ||
|
||
xsltproc ${SLPS}/shared/xsl/rootprods.xslt $1> ${OUTPUT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/sh | ||
|
||
LOCAL=${PWD} | ||
cd `dirname $0` | ||
cd ../.. | ||
SLPS=${PWD} | ||
cd ${LOCAL} | ||
|
||
${SLPS}/topics/investigation/analysis/listtopsbottoms.py $@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,34 @@ | ||
<xsl:stylesheet version = '1.0' | ||
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' | ||
xmlns:bgf="http://planet-sl.org/bgf" | ||
xmlns:xhtml="http://www.w3.org/1999/xhtml"> | ||
|
||
<xsl:output | ||
method="text" | ||
encoding="UTF-8" | ||
omit-xml-declaration="yes" | ||
/> | ||
|
||
<xsl:template match="/bgf:grammar"> | ||
<xsl:text>digraph generated{</xsl:text> | ||
<xsl:for-each select="./bgf:production"> | ||
<xsl:call-template name="findDependencies"> | ||
<xsl:with-param name="start" select="./nonterminal"/> | ||
<xsl:with-param name="traverse" select="./bgf:expression"/> | ||
</xsl:call-template> | ||
</xsl:for-each> | ||
<xsl:text>}</xsl:text> | ||
</xsl:template> | ||
|
||
<xsl:template name="findDependencies"> | ||
<xsl:param name="start"/> | ||
<xsl:param name="traverse"/> | ||
<xsl:for-each select="$traverse//nonterminal"> | ||
<xsl:if test=".!=$start"> | ||
<xsl:value-of select="$start"/> | ||
<xsl:text>-></xsl:text> | ||
<xsl:value-of select="."/> | ||
<xsl:text>;</xsl:text> | ||
</xsl:if> | ||
</xsl:for-each> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bgf="http://planet-sl.org/bgf" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0"> | ||
<xsl:output method="text" encoding="UTF-8" omit-xml-declaration="yes"/> | ||
<xsl:template match="/bgf:grammar"> | ||
<xsl:text>digraph generated{</xsl:text> | ||
<xsl:for-each select="./bgf:production"> | ||
<xsl:call-template name="findDependencies"> | ||
<xsl:with-param name="start" select="./nonterminal"/> | ||
<xsl:with-param name="traverse" select="./bgf:expression"/> | ||
</xsl:call-template> | ||
</xsl:for-each> | ||
<xsl:text>}</xsl:text> | ||
</xsl:template> | ||
<xsl:template name="findDependencies"> | ||
<xsl:param name="start"/> | ||
<xsl:param name="traverse"/> | ||
<xsl:for-each select="$traverse//nonterminal"> | ||
<xsl:if test=".!=$start"> | ||
<xsl:value-of select="$start"/> | ||
<xsl:text>-></xsl:text> | ||
<xsl:value-of select="."/> | ||
<xsl:text>;</xsl:text> | ||
</xsl:if> | ||
</xsl:for-each> | ||
<xsl:for-each select="$traverse//value"> | ||
<xsl:if test=".!=$start"> | ||
<xsl:value-of select="$start"/> | ||
<xsl:text>-></xsl:text> | ||
<xsl:value-of select="."/> | ||
<xsl:text>;</xsl:text> | ||
</xsl:if> | ||
</xsl:for-each> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
test: | ||
make clean | ||
cp ../../convergence/fl/snapshot/*.bgf tests/ | ||
ls -1 tests/*.bgf | xargs -n1 ./testperform | ||
rm *.xbgf | ||
|
||
show: | ||
ls -1 tests/*.ready.bgf | xargs -n1 ../../../shared/tools/showrootprods | ||
|
||
clean: | ||
rm -f *.xbgf tests/*.xbgf tests/*.ready.* tests/*.root.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bgf="http://planet-sl.org/bgf" xmlns:cbgf="http://planet-sl.org/cbgf" xmlns:xbgf="http://planet-sl.org/xbgf" xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0"> | ||
<xsl:output method="xml" encoding="UTF-8"/> | ||
<xsl:template match="/bgf:grammar"> | ||
<xbgf:sequence xmlns:xbgf="http://planet-sl.org/xbgf"> | ||
<xsl:for-each select="root"> | ||
<xsl:call-template name="expose-nonterminal"> | ||
<xsl:with-param name="nt" select="."/> | ||
</xsl:call-template> | ||
</xsl:for-each> | ||
</xbgf:sequence> | ||
</xsl:template> | ||
<xsl:template name="expose-nonterminal"> | ||
<xsl:param name="nt"/> | ||
<xsl:if test="count(/bgf:grammar/bgf:production[nonterminal=$nt]/bgf:expression//nonterminal)=1"> | ||
<xbgf:inline xmlns:xbgf="http://planet-sl.org/xbgf"> | ||
<xsl:value-of select="/bgf:grammar/bgf:production[nonterminal=$nt]/bgf:expression//nonterminal"/> | ||
</xbgf:inline> | ||
</xsl:if> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
../../../shared/generators/reroot2top $1 `basename $1 .bgf`.reroot.xbgf | ||
cp $1 $1.root.bgf | ||
../../../shared/tools/xbgf `basename $1 .bgf`.reroot.xbgf $1 $1.root.bgf | ||
xsltproc generate.xslt $1.root.bgf > $1.expose.xbgf | ||
../../../shared/tools/xbgf $1.expose.xbgf $1.root.bgf $1.ready.bgf |