From 1b8e679c814f3ad111d28921504752d0a6d498e9 Mon Sep 17 00:00:00 2001 From: grammarware Date: Fri, 15 Apr 2011 16:31:40 +0000 Subject: [PATCH] minor pending updates of some tools git-svn-id: https://slps.svn.sourceforge.net/svnroot/slps@1020 ab42f6e0-554d-0410-b580-99e487e6eeb2 --- shared/tools/rsc2bgf | 21 ++++++++++++++++++++ topics/extraction/rascal/extract.py | 2 +- topics/investigation/analysis/present_bgf.py | 1 + 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 shared/tools/rsc2bgf diff --git a/shared/tools/rsc2bgf b/shared/tools/rsc2bgf new file mode 100755 index 00000000..3d429495 --- /dev/null +++ b/shared/tools/rsc2bgf @@ -0,0 +1,21 @@ +#!/bin/sh + +# Get our hands on basedir +LOCAL1=${PWD} +cd `dirname $0` +cd ../.. +SLPS=${PWD} +cd ${LOCAL1} + +if [ $# -ne 2 ]; then + echo "This tool produces a BGF grammar from a Rascal grammar" + echo "Usage:" + echo " rsc2bgf " + exit 1 +elif [ ! -r $1 ]; then + echo "Oops: $1 not found or not readable." + exit 1 +else + python ${SLPS}/topics/extraction/rascal/extract.py $1 $2 +fi + diff --git a/topics/extraction/rascal/extract.py b/topics/extraction/rascal/extract.py index bde4ef3a..f1548f8b 100755 --- a/topics/extraction/rascal/extract.py +++ b/topics/extraction/rascal/extract.py @@ -1,7 +1,7 @@ #!/usr/local/bin/python import os import sys -sys.path.append('../../../shared/python') +sys.path.append(os.getcwd().split('projects')[0]+'projects/slps/shared/python') import slpsns import BGF import elementtree.ElementTree as ET diff --git a/topics/investigation/analysis/present_bgf.py b/topics/investigation/analysis/present_bgf.py index d23b4efd..05f946a2 100755 --- a/topics/investigation/analysis/present_bgf.py +++ b/topics/investigation/analysis/present_bgf.py @@ -28,3 +28,4 @@ print '%20s:' % 'dead top', mb.DEAD(), pa(mb.getDeadTops()) else: print '%20s:' % 'dead top', mb.DEAD() + print 'Terminals used: ',mb.TERM()