File tree 2 files changed +15
-5
lines changed
src/com/plasstech/lang/c/lex
2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 5
5
# Inputs: /path/to/program.c
6
6
# Outputs: /path/to/program (executable)
7
7
8
- # Use last argument as filepath.
9
- filepath=${!# }
8
+ last=${!# }
9
+ library=" "
10
+ # Library linking added page 301
11
+ if [[ $last == ' -lm' ]]; then
12
+ library=" -lm"
13
+ # second to last arg.
14
+ filepath=" ${@: (-2): 1} "
15
+ else
16
+ filepath=" $last "
17
+ fi
18
+
10
19
# Strip the extension
11
20
base=" ${filepath% .* } "
12
- # echo "Compiling $base (.c)"
21
+ echo " Compiling $base (.c)"
13
22
14
23
# Preprocess
15
24
gcc -E -P $base .c -o $base .i
23
32
rv=$?
24
33
if [[ $rv == ' 0' ]]; then
25
34
if [[ $1 == ' -c' ]]; then
26
- gcc -c $base .s -o $base .o
35
+ gcc -c $base .s -o $base .o $library
27
36
else
28
- gcc $base .s -o $base
37
+ gcc $base .s -o $base $library
29
38
fi
30
39
fi
31
40
if [[ $1 != ' -S' ]]; then
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ public enum TokenType {
17
17
LONG (true ),
18
18
UNSIGNED (true ),
19
19
SIGNED (true ),
20
+ DOUBLE (true ),
20
21
IDENTIFIER ,
21
22
// STRING_LITERAL,
22
23
NUMERIC_LITERAL ,
You can’t perform that action at this time.
0 commit comments