lib/Tools/codegen
author wenzelm
Sun, 07 Oct 2007 13:41:31 +0200
changeset 24888 68ff03c069a0
parent 24620 40811901b998
child 25451 7bd190cac91e
permissions -rwxr-xr-x
Basic Isabelle mode for jEdit -- http://www.jedit.org/

#!/usr/bin/env bash
#
# $Id$
# Author: Florian Haftmann, TUM
#
# DESCRIPTION: issue code generation from shell


## diagnostics

PRG="$(basename "$0")"

function usage()
{
  echo
  echo "Usage: $PRG IMAGE THY SERI"
  echo
  echo "  Issues code generation using image IMAGE,"
  echo "  theory THY,"
  echo "  with Isar command 'export_code SERI'"
  echo
  exit 1
}


## process command line

[ "$#" -lt 2 -o "$1" = "-?" ] && usage

IMAGE="$1"; shift
THY="$1"; shift
SERI="$1"


## main

SERI=$(echo $SERI | sed -e 's/\\/\\\\"/g; s/"/\\\"/g')
CMD="Isar.toplevel (fn _ => (use_thy \"$THY\"; CodePackage.codegen_command (theory \"$THY\") \"$SERI\"))"

"$ISABELLE" -q -e "$CMD" "$IMAGE"