@@ -255,13 +255,13 @@ which gives us an actual `Clos a`. Now for the third step we have
255
255
` rebind ` .
256
256
257
257
` rebind ` maps a free variable to ` Maybe Int ` . It maps a free variable
258
- to it's binding occurrence it has one here . This boils down to using
258
+ to its binding occurrence if has one. This boils down to using
259
259
` elemIndex ` to look up somethings position in the ` Clos ` we just built
260
260
up. We also have a special case for when the variable we're looking at
261
261
is the "argument" of the function we're fixing. In this case we want
262
- to map it to the last thing we're binding, which is just
263
- ` length n` . To capture the "try this and then that" semantics we use
264
- the alternative instance for ` Maybe ` which works wonderfully.
262
+ to map it to the last thing we're binding, which is just `length
263
+ n`. To capture the "try this and then that" semantics we use the
264
+ alternative instance for ` Maybe ` which works wonderfully.
265
265
266
266
With this, we've removed implicit closures from our language: one
267
267
of the passes on our way to C.
@@ -291,7 +291,7 @@ Here's our new language.
291
291
deriving (Eq , Functor , Foldable , Traversable )
292
292
```
293
293
294
- Much here is the same except we've romved both lambdas and fixpoints
294
+ Much here is the same except we've removed both lambdas and fixpoints
295
295
and replaced them with `LetL `. `LetL ` works over bindings which are
296
296
either recursive (`Fix `) or nonrecursive (`Lam `). Lambda lifting in
297
297
this compiler is rather simplistic in how it lifts lambdas: we just
@@ -492,14 +492,14 @@ To lift a binding all we do is generate a globally unique identifier
492
492
for the toplevel. Once we have that we that we can unwrap the
493
493
particular binding we're looking at. This is going to comprise the
494
494
body of the ` TopC ` function we're building. Since we need it to be
495
- ` FauxC ` code as well we recurse on it. No we have a bunch of faux-C
495
+ ` FauxC ` code as well, we recurse on it. No we have a bunch of faux-C
496
496
code for the body of the toplevel function. We then just repackage the
497
497
body up into a binding (a ` FauxCTop ` needs one) and use ` tell ` to make
498
498
a note of it. Once we've done that we return the stripped down let
499
499
binding that just remembers the guid that we created for the toplevel
500
500
function.
501
501
502
- In an example, this code transformers
502
+ In an example, this code transforms
503
503
504
504
``` haskell
505
505
let x = λ (x : τ). ... in
@@ -601,7 +601,7 @@ The first few cases for conversion are nice and straightforward.
601
601
We take advantage of the fact that ` realc ` returns it's result and we
602
602
can almost make this look like the applicative cases we had
603
603
before. One particularly slick case is how ` Suc ` works. We compute the
604
- value of ` e ` and apply the result to ` suc ` . We then feed this
604
+ value of ` e ` and apply the result to ` inc ` . We then feed this
605
605
expression into ` tellDecl ` which binds it to a fresh variable and
606
606
returns the variable. Haskell is pretty slick.
607
607
@@ -683,7 +683,7 @@ Next, we have a function for converting a faux C function into an
683
683
actual function definition. This is the function that we use ` realc `
684
684
in.
685
685
686
- ``` haskel
686
+ ``` haskell
687
687
topc :: FauxCTop CExpr -> Gen Integer CFunDef
688
688
topc (FauxCTop i numArgs body) = do
689
689
binds <- gen
0 commit comments