#!/bin/bash while [[ $1 = -* ]] do case $1 in -h|--help) echo echo "To use this script to 'compile' a helloworld program, you must set" echo "environment variables:" echo " SUNSHINE_JAR to the full path to the executable sunshine jar downloaded from Metaborg" echo " ECLIPSE_INSTALL to the directory where your eclipse executable (with Spoofax plugin) resides" echo " HELLOWORLD_PROJECT to the project directory of this project" echo "(or of course you could make a copy of this script with those directories hardcoded)." echo echo "Usage:" echo " hel2py [-q] FILE" echo "You can specify -q to suppress standard error output." echo "Writes the Python translation of FILE to standard out." echo "So you can 'execute' the file with" echo " hel2py -q FILE | python3 -" exit ;; -q) shift exec 2>/dev/null ;; esac done java -jar $SUNSHINE_JAR transform -i $1 -n "Generate Python" -p $HELLOWORLD_PROJECT -l $HELLOWORLD_PROJECT -l "${ECLIPSE_INSTALL}/plugins"