3636
3737@title[#:tag "Abscond " ]{Abscond: a language of numbers}
3838
39- @src-code["abscond " ]
39+ @(define lang-name "abscond " )
40+ @(define prefix (string-append lang-name "- " ))
41+
42+ @src-code[lang-name]
4043
4144@emph{Let's Make a Programming Language!}
4245
4346@table-of-contents[]
4447
45- @section{Overview}
48+ @section[ #:tag-prefix prefix ] {Overview}
4649
4750A compiler is just one (optional!) component of a @emph{programming
4851language}. So if you want to make a compiler, you must first settle
@@ -96,7 +99,7 @@ To begin, let's start with a dead simple programming language called
9699literals. Running an abscond program just produces that integer.
97100(Told you it was simple.)
98101
99- @section{Concrete syntax for Abscond}
102+ @section[ #:tag-prefix prefix ] {Concrete syntax for Abscond}
100103
101104We will simplify matters of syntax by using the Lisp
102105notation of s-expression for the @bold{concrete} form of
@@ -153,7 +156,7 @@ line and then using the @racket[read] function to
153156parse the concrete expression as an s-expression.
154157
155158
156- @section{Abstract syntax for Abscond}
159+ @section[ #:tag-prefix prefix ] {Abstract syntax for Abscond}
157160
158161While not terribly useful for a language as overly simplistic as Abscond, we use
159162an AST datatype for representing expressions and another syntactic categories.
@@ -175,7 +178,7 @@ it is, otherwise it signals an error:
175178(eval:error (parse #t ))]
176179
177180
178- @section{Meaning of Abscond programs}
181+ @section[ #:tag-prefix prefix ] {Meaning of Abscond programs}
179182
180183The meaning of an Abscond program is simply the number itself. So
181184@racket[(Lit 42 )] evaluates to @racket[42 ].
@@ -267,7 +270,7 @@ operational semantics and an interpreter, which is (obviously)
267270correct. Now let 's write a compiler.
268271}
269272
270- @section{Toward a Compiler for Abscond}
273+ @section[ #:tag-prefix prefix ] {Toward a Compiler for Abscond}
271274
272275A compiler, like an interpreter, is an implementation of a programming
273276language. The key difference is that a compiler stages the work of
@@ -343,7 +346,7 @@ with an object file that contains @tt{entry} will produce an
343346executable that, when run, will carry out the execution of an Abscond
344347program.
345348
346- @section{An Example}
349+ @section[ #:tag-prefix prefix ] {An Example}
347350
348351Before trying to write the Abscond compiler, let 's first make an
349352example of what we would like the compiler to produce for a particular
@@ -408,7 +411,7 @@ We now have a working example. The remaining work will be to design a
408411compiler that takes an Abscond program and emits a file like
409412@tt{42.s}, but with the appropriate integer literal.
410413
411- @section{A Compiler for Abscond}
414+ @section[ #:tag-prefix prefix ] {A Compiler for Abscond}
412415
413416We will now write a compiler for Abscond. To heart of the compiler
414417will be a function with the following signature:
@@ -510,7 +513,7 @@ Moreover, we can compare our compiled code to code compiled by Racket:
510513 "time -p racket 42.rkt " ]
511514
512515
513- @section{But is it @emph{Correct}?}
516+ @section[ #:tag-prefix prefix ] {But is it @emph{Correct}?}
514517
515518At this point, we have a compiler for Abscond. But is it correct?
516519What does that even mean, to be correct?
0 commit comments