forked from DoctorWkt/acwj
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Warren Toomey
committed
Oct 27, 2019
1 parent
fc809d1
commit 7d02ad3
Showing
64 changed files
with
3,413 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
SRCS= cg.c decl.c expr.c gen.c main.c misc.c scan.c stmt.c \ | ||
sym.c tree.c types.c | ||
|
||
ARMSRCS= cg_arm.c decl.c expr.c gen.c main.c misc.c scan.c stmt.c \ | ||
sym.c tree.c types.c | ||
|
||
comp1: $(SRCS) | ||
cc -o comp1 -g -Wall $(SRCS) | ||
|
||
comp1arm: $(ARMSRCS) | ||
cc -o comp1arm -g -Wall $(ARMSRCS) | ||
cp comp1arm comp1 | ||
|
||
clean: | ||
rm -f comp1 comp1arm *.o *.s out | ||
|
||
test: comp1 tests/runtests | ||
(cd tests; chmod +x runtests; ./runtests) | ||
|
||
armtest: comp1arm tests/runtests | ||
(cd tests; chmod +x runtests; ./runtests) | ||
|
||
test20: comp1 tests/input20.c lib/printint.c | ||
./comp1 tests/input20.c | ||
cc -o out out.s lib/printint.c | ||
./out | ||
|
||
armtest20: comp1arm tests/input20.c lib/printint.c | ||
./comp1 tests/input20.c | ||
cc -o out out.s lib/printint.c | ||
./out |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
int ary[5]; | ||
int *ptr; | ||
|
||
ary[3]= 63; // Set ary[3] (lvalue) to 63 | ||
ptr = ary; // Point ptr to base of ary | ||
// ary= ptr; // error: assignment to expression with array type | ||
ptr = &ary[0]; // Also point ptr to base of ary, ary[0] is lvalue | ||
ptr[4]= 72; // Use ptr like an array, ptr[4] is an lvalue | ||
|
||
.globl z | ||
z: .quad 1 | ||
.quad 2 | ||
.quad 3 | ||
.quad 4 | ||
.globl zc | ||
zc: .byte 1 | ||
.byte 2 | ||
.byte 3 | ||
.byte 4 | ||
.byte 0 | ||
.byte 0 | ||
.byte 0 | ||
.byte 0 |
Oops, something went wrong.