Add another paragraph to the 6th part of the compiler series
This commit is contained in:
parent
44abf877b2
commit
77cfeda60d
|
@ -87,5 +87,18 @@ $$
|
|||
\\mathcal{C} ⟦f⟧ \; \\rho = [\\text{PushGlobal} \\; f]
|
||||
$$
|
||||
|
||||
Next up, case expressions. These are a bit more complex: there are several
|
||||
branches, each of which will have its own environment.
|
||||
Now it's time for us to compile case expressions, but there's a bit of
|
||||
an issue - our case expressions branches don't map one-to-one with
|
||||
the \\(t \\rightarrow i\_t\\) format of the Jump instruction.
|
||||
This is because we allow for name patterns in the form \\(x\\),
|
||||
which can possibly match more than one tag. Consider this
|
||||
rather useless example:
|
||||
|
||||
```
|
||||
data Bool = { True, False }
|
||||
defn weird b = { case b of { b -> { False } } }
|
||||
```
|
||||
|
||||
We only have one branch, but we have two tags that should
|
||||
lead to it!
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user