Skip to content

Commit 4172aa8

Browse files
committed
Compile from stdin instead of file.
1 parent fc31655 commit 4172aa8

62 files changed

Lines changed: 311 additions & 382 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

langs/abscond/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ runtime.o: $(objs)
2525
nasm -g -f $(format) -o $@ $<
2626

2727
%.s: %.rkt
28-
racket -t compile-file.rkt -m $< > $@
28+
cat $< | racket -t compile-stdin.rkt -m > $@
2929

3030
clean:
3131
rm *.o *.s *.run

langs/abscond/compile-file.rkt

Lines changed: 0 additions & 13 deletions
This file was deleted.

langs/abscond/compile-stdin.rkt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#lang racket
2+
(provide main)
3+
(require "parse.rkt" "compile.rkt" a86/printer)
4+
5+
;; -> Void
6+
;; Compile contents of stdin,
7+
;; emit asm code on stdout
8+
(define (main)
9+
(read-line) ; ignore #lang racket line
10+
(asm-display (compile (parse (read)))))

langs/blackmail/Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
UNAME := $(shell uname)
2-
.PHONY: test
32

43
ifeq ($(UNAME), Darwin)
54
format=macho64
@@ -17,19 +16,19 @@ runtime.o: $(objs)
1716
ld -r $(objs) -o runtime.o
1817

1918
%.run: %.o runtime.o
20-
gcc runtime.o $< -o $@
19+
arch -x86_64 gcc runtime.o $< -o $@
2120

2221
.c.o:
23-
gcc -fPIC -c -g -o $@ $<
22+
arch -x86_64 gcc -fPIC -c -g -o $@ $<
2423

2524
.s.o:
2625
nasm -g -f $(format) -o $@ $<
2726

2827
%.s: %.rkt
29-
racket -t compile-file.rkt -m $< > $@
28+
cat $< | racket -t compile-stdin.rkt -m > $@
3029

3130
clean:
3231
rm *.o *.s *.run
3332

34-
test: example.run
35-
@test "$(shell ./example.run)" = "$(shell racket example.rkt)"
33+
%.test: %.run %.rkt
34+
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"

langs/blackmail/compile-file.rkt

Lines changed: 0 additions & 13 deletions
This file was deleted.

langs/blackmail/compile-stdin.rkt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#lang racket
2+
(provide main)
3+
(require "parse.rkt" "compile.rkt" a86/printer)
4+
5+
;; -> Void
6+
;; Compile contents of stdin,
7+
;; emit asm code on stdout
8+
(define (main)
9+
(read-line) ; ignore #lang racket line
10+
(asm-display (compile (parse (read)))))

langs/con/Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
UNAME := $(shell uname)
2-
.PHONY: test
32

43
ifeq ($(UNAME), Darwin)
54
format=macho64
@@ -17,19 +16,19 @@ runtime.o: $(objs)
1716
ld -r $(objs) -o runtime.o
1817

1918
%.run: %.o runtime.o
20-
gcc runtime.o $< -o $@
19+
arch -x86_64 gcc runtime.o $< -o $@
2120

2221
.c.o:
23-
gcc -fPIC -c -g -o $@ $<
22+
arch -x86_64 gcc -fPIC -c -g -o $@ $<
2423

2524
.s.o:
2625
nasm -g -f $(format) -o $@ $<
2726

2827
%.s: %.rkt
29-
racket -t compile-file.rkt -m $< > $@
28+
cat $< | racket -t compile-stdin.rkt -m > $@
3029

3130
clean:
3231
rm *.o *.s *.run
3332

34-
test: example.run
35-
@test "$(shell ./example.run)" = "$(shell racket example.rkt)"
33+
%.test: %.run %.rkt
34+
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"

langs/con/compile-file.rkt

Lines changed: 0 additions & 13 deletions
This file was deleted.

langs/con/compile-stdin.rkt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#lang racket
2+
(provide main)
3+
(require "parse.rkt" "compile.rkt" a86/printer)
4+
5+
;; -> Void
6+
;; Compile contents of stdin,
7+
;; emit asm code on stdout
8+
(define (main)
9+
(read-line) ; ignore #lang racket line
10+
(asm-display (compile (parse (read)))))

langs/dodger/Makefile

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
UNAME := $(shell uname)
2-
.PHONY: test
32

43
ifeq ($(UNAME), Darwin)
54
format=macho64
@@ -9,28 +8,28 @@ endif
98

109
objs = \
1110
main.o \
12-
values.o \
13-
print.o
11+
print.o \
12+
values.o
1413

1514
default: runtime.o
1615

1716
runtime.o: $(objs)
1817
ld -r $(objs) -o runtime.o
1918

2019
%.run: %.o runtime.o
21-
gcc runtime.o $< -o $@
20+
arch -x86_64 gcc runtime.o $< -o $@
2221

2322
.c.o:
24-
gcc -fPIC -c -g -o $@ $<
23+
arch -x86_64 gcc -fPIC -c -g -o $@ $<
2524

2625
.s.o:
2726
nasm -g -f $(format) -o $@ $<
2827

2928
%.s: %.rkt
30-
racket -t compile-file.rkt -m $< > $@
29+
cat $< | racket -t compile-stdin.rkt -m > $@
3130

3231
clean:
3332
rm *.o *.s *.run
3433

35-
test: example.run
36-
@test "$(shell ./example.run)" = "$(shell racket example.rkt)"
34+
%.test: %.run %.rkt
35+
@test "$(shell ./$(<))" = "$(shell racket $(word 2,$^))"

0 commit comments

Comments
 (0)