-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
executable file
·96 lines (80 loc) · 3.65 KB
/
build.xml
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<!-- ant build file for cse 401 compiler project -->
<!-- hp, 1/10, 8/11 -->
<!-- Possible future changes:
- use symbolic variables for various class and path names
- add options to interface better with internal eclipse compiler -->
<project name="Compilador Mini Java" default="compile">
<!-- build targets for compiler -->
<!-- you might not need to change much of anything here except for compiler warnings -->
<target name="init">
<mkdir dir="build/classes" />
</target>
<target name="clean">
<delete dir="build" />
<delete file="src/Parser/parser.java" />
<delete file="src/Parser/sym.java" />
<delete file="src/Scanner/scanner.java" />
<delete file="src/Scanner/scanner.java~" />
</target>
<target name="check.parse.files">
<uptodate targetfile="src/Parser/parser.java" srcfile="src/Parser/minijava.cup" property="parser.uptodate" />
<uptodate targetfile="src/Scanner/scanner.java" srcfile="src/Scanner/minijava.jflex" property="scanner.uptodate" />
<condition property="scanner.parser.uptodate">
<and>
<isset property="scanner.uptodate" />
<isset property="parser.uptodate" />
</and>
</condition>
</target>
<target name="gen-parser" depends="check.parse.files" unless="parser.uptodate">
<java jar="lib/CUP.jar" fork="true" failonerror="true" output="build/cup.out">
<arg value="-dump_states" />
<arg value="-dump_grammar" />
<arg value="-dump_tables" />
<arg value="-destdir" />
<arg value="src/Parser" />
<arg value="src/Parser/minijava.cup" />
</java>
</target>
<target name="gen-scanner" depends="gen-parser, check.parse.files" unless="scanner.parser.uptodate">
<java classname="jflex.Main" classpath="lib/jflex-1.6.0.jar" fork="true" failonerror="true">
<arg value="src/Scanner/minijava.jflex" />
</java>
</target>
<!-- Remove comment on compilerarg line below to generate compiler warnings
for unchecked casts. Even if the minijava code is clean, there may be
warnings in java code generated by cup. -->
<target name="compile" depends="init, gen-scanner">
<javac srcdir="src" destdir="build/classes" classpath="lib/CUP.jar" includeAntRuntime="false">
<!-- <compilerarg value="-Xlint:unchecked"/> -->
</javac>
</target>
<!-- targets for running test programs -->
<!-- you will want to expand on what's here. -->
<!-- run scanner and parser test programs on initial demo input -->
<target name="test-scanner" depends="compile">
<java classname="TestScanner" classpath="build/classes;lib/CUP.jar" fork="true" input="SamplePrograms/SampleMiniJavaPrograms/Factorial.java" />
</target>
<target name="test-parser" depends="compile">
<java classname="TestParser" classpath="build/classes;lib/CUP.jar" fork="true" input="SamplePrograms/SampleMiniJavaPrograms/Factorial.java" />
</target>
<target name="test-semantic" depends="compile">
<java classname="TestSemantic" classpath="build/classes;lib/CUP.jar" fork="true" input="SamplePrograms/SampleMiniJavaPrograms/Factorial.java" />
</target>
<target name="test-code-generator" depends="compile">
<java classname="TestCodeGenerator"
classpath="build/classes;lib/CUP.jar"
fork="true"
input="SamplePrograms/SampleMiniJavaPrograms/Factorial.java">
<arg value="src/Files/Factorial.asm" />
</java>
</target>
<target name="test-intermediate-code" depends="compile">
<java classname="TestIntermediateCode"
classpath="build/classes;lib/CUP.jar"
fork="true"
input="SamplePrograms/SampleMiniJavaPrograms/Factorial.java">
<arg value="src/Files/Factorial.int" />
</java>
</target>
</project>