#!/usr/bin/python
import os
import sys

# validate user input
if len(sys.argv) != 2:
	print 'Usage: genex.py <grammar_file>'
	sys.exit(1)
grammar_file = sys.argv[1]

# set PYTHONPATH
os.environ['PYTHONPATH'] = '/home/wanghy/youGen_dist/src'

# in case genex.py and parser.py are not in the same folder
os.environ['PATH'] += ':' + os.environ['PYTHONPATH']

# execute grammar file
if grammar_file.endswith('.gr'):
	os.system('parser.py ' + grammar_file)
os.system('python ' + grammar_file[:-3] + '.py')
