Skip to content

Instantly share code, notes, and snippets.

@pedroduartecosta
Forked from bm-vs/comp.sh
Created February 19, 2017 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedroduartecosta/1d6987c2e4f7588413d3b4cb975e7119 to your computer and use it in GitHub Desktop.
Save pedroduartecosta/1d6987c2e4f7588413d3b4cb975e7119 to your computer and use it in GitHub Desktop.
#!/bin/bash
file=$1
if [ ${file: -1} == "t" ]; then
jjtree $file
file=${file%t}
fi
javacc $file
javac *.java
name=${file%.*}
echo "________________________________________________________________________________"
echo
java $name

comp

Script to make javacc and jjtree easier to generate, compile and execute. To use:

  1. Download the file

  2. Modify the chmod of the script: chmod +x comp

  3. Copy the script to /usr/bin: cp comp /usr/bin

javacc

Replaces the commands:

javacc Example.jj
javac *.java
java Example

with:

comp Example.jj

jjtree

Replaces the commands:

jjtree Example.jjt
javacc Example.jj
javac *.java
java Example

with:

comp Example.jjt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment