From 77cfeda60da1babb95609b5d295729833cbae358 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Wed, 4 Sep 2019 21:45:39 -0700 Subject: [PATCH] Add another paragraph to the 6th part of the compiler series --- content/blog/06_compiler_semantics.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/content/blog/06_compiler_semantics.md b/content/blog/06_compiler_semantics.md index 87fa1a6..1cf6b72 100644 --- a/content/blog/06_compiler_semantics.md +++ b/content/blog/06_compiler_semantics.md @@ -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! +