-
Notifications
You must be signed in to change notification settings - Fork 0
/
xic-build
executable file
·53 lines (48 loc) · 1.96 KB
/
xic-build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
ROOT_DIR=`dirname "$0"`
# jflex
echo "removing existing Lexer.java"
rm -f ${ROOT_DIR}/src/main/java/mtm68/lexer/Lexer.java
echo "generating new Lexer.java"
${ROOT_DIR}/lib/jflex-1.8.2/bin/jflex ${ROOT_DIR}/src/main/java/mtm68/lexer/lexer.flex
# cup
echo "removing existing sym.java"
rm -f ${ROOT_DIR}/src/main/java/mtm68/parser/sym.java
echo "removing existing Parser.java"
rm -f ${ROOT_DIR}/src/main/java/mtm68/parser/Parser.java
echo "generating new Parser.java and Sym.java"
./cup -destdir ${ROOT_DIR}/src/main/java/mtm68/parser -parser Parser ${ROOT_DIR}/src/main/java/mtm68/parser/xi.cup
# ir jflex and cup
# echo "removing existing IRLexer.java"
# rm -f ${ROOT_DIR}/src/main/java/edu/cornell/cs/cs4120/ir/parse/IRLexer.java
# echo "generating new IRLexer.java"
# ${ROOT_DIR}/lib/jflex-1.8.2/bin/jflex ${ROOT_DIR}/src/main/java/edu/cornell/cs/cs4120/ir/parse/ir.flex
# echo "removing existing IRSym.java"
# rm -f ${ROOT_DIR}/src/main/java/edu/cornell/cs/cs4120/ir/parse/IRSym.java
# echo "removing existing IRParser.java"
# rm -f ${ROOT_DIR}/src/main/java/edu/cornell/cs/cs4120/ir/parse/IRParser.java
# echo "generating new IRParser.java and IRSym.java"
# ./cup -destdir ${ROOT_DIR}/src/main/java/edu/cornell/cs/cs4120/ir/parse -symbols IRSym -parser IRParser ${ROOT_DIR}/src/main/java/edu/cornell/cs/cs4120/ir/parse/ir.cup
#
# Dependencies
mvn install:install-file \
-Dfile=${ROOT_DIR}/lib/jflex-1.8.2/lib/jflex-full-1.8.2.jar \
-DgroupId=de.jflex \
-DartifactId=jflex \
-Dversion=1.8.2 \
-Dpackaging=jar \
-DgeneratePom=true \
-DlocalRepositoryPath=${ROOT_DIR}/lib
mvn install:install-file \
-Dfile=${ROOT_DIR}/lib/java_cup.jar \
-DgroupId=cup \
-DartifactId=cup \
-Dversion=1.0 \
-Dpackaging=jar \
-DgeneratePom=true \
-DlocalRepositoryPath=${ROOT_DIR}/lib
# Create jar
mvn package -Dmaven.repo.local=${ROOT_DIR}/lib
## Create executable
echo "java -cp ${ROOT_DIR}/target/xic-0.0.1-SNAPSHOT.jar mtm68.Main \$@" > xic
chmod +x xic