-
Notifications
You must be signed in to change notification settings - Fork 1
/
RedRules.agda
54 lines (49 loc) · 3.22 KB
/
RedRules.agda
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module PrettyPrinter.GraphViz.RedRules where
open import Agda.Builtin.String
open import Text.Printf
open import CC.CCStatics
open import CC.Reduction
print-cast-rule : ∀ {A B} {c : Cast A ⇒ B} {V M}
→ ApplyCast V , c ↝ M → String
print-cast-rule cast-base-id = "\\graytext{\\textit{-base-id}}"
print-cast-rule (cast-base-proj _) = "\\graytext{\\textit{-base-proj}}"
print-cast-rule (cast-base-proj-blame _) = "\\graytext{\\textit{-base-proj-blame}}"
print-cast-rule cast-fun-id⋆ = "\\graytext{\\textit{-fun-id\\unk}}"
print-cast-rule (cast-fun-proj _) = "\\graytext{\\textit{-fun-proj}}"
print-cast-rule (cast-fun-proj-blame _) = "\\graytext{\\textit{-fun-proj-blame}}"
print-cast-rule cast-fun-pc-id⋆ = "\\graytext{\\textit{-fun-pc-id\\unk}}"
print-cast-rule (cast-fun-pc-proj _) = "\\graytext{\\textit{-fun-pc-proj}}"
print-cast-rule (cast-fun-pc-proj-blame _) = "\\graytext{\\textit{-fun-pc-proj-blame}}"
print-cast-rule cast-ref-id⋆ = "\\graytext{\\textit{-ref-id\\unk}}"
print-cast-rule (cast-ref-proj _) = "\\graytext{\\textit{-ref-proj}}"
print-cast-rule (cast-ref-proj-blame _) = "\\graytext{\\textit{-ref-proj-blame}}"
print-cast-rule cast-ref-ref-id⋆ = "\\graytext{\\textit{-ref-ref-id\\unk}}"
print-cast-rule (cast-ref-ref-proj _) = "\\graytext{\\textit{-ref-ref-proj}}"
print-cast-rule (cast-ref-ref-proj-blame _) = "\\graytext{\\textit{-ref-ref-proj-blame}}"
print-red-rule : ∀ {M M′ μ μ′ pc} → M ∣ μ ∣ pc —→ M′ ∣ μ′ → String
print-red-rule (ξ M→M′) = printf "$\\xi$(%s)" (print-red-rule M→M′)
print-red-rule ξ-err = "$\\xi$\\textit{-err}"
print-red-rule (prot-val _) = "\\textit{prot-val}"
print-red-rule (prot-ctx M→M′) = printf "\\textit{prot-ctx}(%s)" (print-red-rule M→M′)
print-red-rule prot-err = "\\textit{prot-err}"
print-red-rule (β _) = "$\\beta$"
print-red-rule β-if-true = "$\\beta$\\textit{-if-true}"
print-red-rule β-if-false = "$\\beta$\\textit{-if-false}"
print-red-rule (β-let _) = "$\\beta$\\textit{-let}"
print-red-rule ref-static = "\\textit{ref-static}"
print-red-rule (ref?-ok _) = "\\textit{ref?-ok}"
print-red-rule (ref?-fail _) = "\\textit{ref?-fail}"
print-red-rule (ref _ _) = "\\textit{ref}"
print-red-rule (deref _) = "\\textit{deref}"
print-red-rule assign-static = "\\textit{assign-static}"
print-red-rule (assign?-ok _) = "\\textit{assign?-ok}"
print-red-rule (assign?-fail _) = "\\textit{assign?-fail}"
print-red-rule (assign _) = "\\textit{assign}"
print-red-rule (cast _ _ app) = printf "\\textit{cast}%s" (print-cast-rule app)
print-red-rule (if-cast-true _) = "\\textit{if-cast-true}"
print-red-rule (if-cast-false _) = "\\textit{if-cast-false}"
print-red-rule (fun-cast _ _ _) = "\\textit{fun-cast}"
print-red-rule (deref-cast _ _) = "\\textit{deref-cast}"
print-red-rule (assign?-cast _ _) = "\\textit{assign?-cast}"
print-red-rule (assign-cast _ _ _) = "\\textit{assign-cast}"
print-red-rule (β-cast-pc _) = "$\\beta$\\textit{-cast-pc}"