Skip to content

Commit 1182a7e

Browse files
committed
Use stdin approach in notes.
1 parent 4172aa8 commit 1182a7e

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

www/notes/abscond.scrbl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#'(void)))]))
3232

3333
@;{ Have to compile 42.s (at expand time) before listing it }
34-
@(shell-expand "racket -t compile-file.rkt -m 42.rkt > 42.s")
34+
@(shell-expand "cat 42.rkt | racket -t compile-stdin.rkt -m > 42.s")
3535

3636

3737
@title[#:tag "Abscond"]{Abscond: a language of numbers}
@@ -438,11 +438,11 @@ Putting it all together, we can write a command line compiler much
438438
like the command line interpreter before, except now we emit assembly
439439
code:
440440

441-
@codeblock-include["abscond/compile-file.rkt"]
441+
@codeblock-include["abscond/compile-stdin.rkt"]
442442

443443
Example:
444444

445-
@shellbox["racket -t compile-file.rkt -m 42.rkt"]
445+
@shellbox["cat 42.rkt | racket -t compile-stdin.rkt -m"]
446446

447447
Using a Makefile, we can capture the whole compilation dependencies as:
448448

www/notes/blackmail.scrbl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#'(void)))]))
3030

3131
@;{ Have to compile 42.s (at expand time) before listing it }
32-
@(shell-expand "racket -t compile-file.rkt -m add1-add1-40.rkt > add1-add1-40.s")
32+
@(shell-expand "cat add1-add1-40.rkt | racket -t compile-stdin.rkt -m > add1-add1-40.s")
3333

3434
@title[#:tag "Blackmail"]{Blackmail: incrementing and decrementing}
3535

@@ -247,10 +247,10 @@ We can now try out a few examples:
247247
]
248248

249249
And give a command line wrapper for parsing, checking, and compiling
250-
files in @link["code/blackmail/compile-file.rkt"]{@tt{compile-file.rkt}},
250+
in @link["code/blackmail/compile-stdin.rkt"]{@tt{compile-stdin.rkt}},
251251
we can compile files as follows:
252252

253-
@shellbox["racket -t compile-file.rkt -m add1-add1-40.rkt"]
253+
@shellbox["cat add1-add1-40.rkt | racket -t compile-stdin.rkt -m"]
254254

255255
And using the same @link["code/blackmail/Makefile"]{@tt{Makefile}}
256256
setup as in Abscond, we capture the whole compilation process with a

www/notes/evildoer.scrbl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ writing!) do not have this property. Instead they interact
8585
with the outside world and compute results based on the
8686
state of the world.
8787

88-
For example, consider the @tt{compile-file.rkt} program,
89-
which reads the contents of a file from disk and compiles
90-
it. The meaning of this program depends on the state of your
91-
computer's hard drive. Similarly, it prints out assembly
88+
For example, consider the @tt{compile-stdin.rkt} program,
89+
which reads the contents of stdin and compiles
90+
it. The meaning of this program depends on the state of input
91+
port. Similarly, it prints out assembly
9292
code to the standard output port. So not only does this
9393
program depend on the outside world, it changes it too.
9494

www/notes/iniquity.scrbl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ is updated to include function applications.
113113

114114
Because of the change from a program being a single expression to a
115115
sequence, we have to update the utilities that read program files,
116-
i.e. @tt{interp-file.rkt} and @tt{compile-file.rkt}:
116+
i.e. @tt{interp-file.rkt} and @tt{compile-stdin.rkt}:
117117

118118
@codeblock-include["iniquity/interp-file.rkt"]
119-
@codeblock-include["iniquity/compile-file.rkt"]
119+
@codeblock-include["iniquity/compile-stdin.rkt"]
120120

121121

122122

0 commit comments

Comments
 (0)