From 16f81871669f205e11d7965a989b6f467f80c5d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20M=C3=A4kel=C3=A4?= Date: Tue, 15 Aug 2017 22:15:43 +0300 Subject: added Switch specification --- docs/julia.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/julia.rst b/docs/julia.rst index 2f0b7d28..c10e3d29 100644 --- a/docs/julia.rst +++ b/docs/julia.rst @@ -248,6 +248,19 @@ We will use a destructuring notation for the AST nodes. G, L, break E(G, L, continue: BreakContinue) = G, L, continue + E(G, L, : Switch) = + E(G, L, switch condition case l1:t1 st1 ... case ln:tn stn default {}) = + E(G, L, : Switch) = + let G0, L0, v = E(G, L, condition) + // i = 1 .. n + // Evaluate literals, context doesn't matter + let G0, L0, v1 = E(G0, L0, l1) + ... + let G0, L0, vn = E(G0, L0, ln) + if there exists smallest i such that vi = v: + E(G0, L0, sti) + else: + E(G0, L0, st') E(G, L, : Identifier) = G, L, L[$name] -- cgit v1.2.3