Skip to content

Commit

Permalink
some new tools: ASF+SDF wrappers and extractor
Browse files Browse the repository at this point in the history
git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@156 ab42f6e0-554d-0410-b580-99e487e6eeb2
  • Loading branch information
grammarware committed Aug 15, 2008
1 parent de361ae commit ccefcaf
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
28 changes: 28 additions & 0 deletions shared/tools/runasfsdfevaluator
@@ -0,0 +1,28 @@
#!/bin/bash

# Get our hands on basedir
LOCAL1=${PWD}
cd `dirname $0`
cd ../..
SLPS=${PWD}
cd topics/fl/asfsdf
SDF=${PWD}
cd ${LOCAL1}

if [ $# -ne 3 ]; then
echo "This script wraps up the ASF+SDF evaluator"
echo "Usage: $0 <context> <input> <yields>"
exit 1
elif [ ! -r $1 ]; then
echo "Oops: $1 not found or not readable."
exit 1
fi

cat $1 > tempfile1
echo -n "evaluator x = " >> tempfile1
cat $2 >> tempfile1
cat tempfile1 | python ${SDF}/pre.py | sglr -p ${SDF}/FL.tbl | asfe -e ${SDF}/FL.eqs | unparsePT | python ${SDF}/post.py | grep "evaluator x" | awk '{print $4}' > tempfile2
echo $3 > tempfile1
diff tempfile1 tempfile2
rm -f tempfile1 tempfile2

22 changes: 22 additions & 0 deletions shared/tools/runasfsdfparser
@@ -0,0 +1,22 @@
#!/bin/sh

# Get our hands on basedir
LOCAL1=${PWD}
cd `dirname $0`
cd ../..
SLPS=${PWD}
cd topics/fl/asfsdf
SDF=${PWD}
cd ${LOCAL1}

if [ $# -ne 2 ]; then
echo "This script wraps up the ASF+SDF parser"
echo "Usage: $0 <input> <output>"
exit 1
elif [ ! -r $1 ]; then
echo "Oops: $1 not found or not readable."
exit 1
fi

cat $1 | python ${SDF}/pre.py | sglr -p ${SDF}/FL.tbl | asfe -e ${SDF}/FL.eqs | unparsePT | python ${SDF}/post.py > $2

22 changes: 22 additions & 0 deletions shared/tools/sdf2bgf
@@ -0,0 +1,22 @@
#! /bin/sh

# Get our hands on basedir
LOCAL1=${PWD}
cd `dirname $0`
cd ../../topics/extraction/sdf2bgf
XTR=${PWD}
cd ${LOCAL1}

if [ $# -ne 2 ]; then
echo "Usage: sdf2bgf <SDF-input> <BGF-output>"
exit 1
elif [ ! -r $1 ]; then
echo "Oops: $1 not found or not readable."
exit 1
else
# Build extractor if needed
cd ${XTR}
make build
cd ${LOCAL1}
(echo "main("; cat $1; echo ")" ) | sglr -p ${XTR}/Main.tbl | asfe -e ${XTR}/Main.eqs | unparsePT > $2
fi

0 comments on commit ccefcaf

Please sign in to comment.