aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-11-22 21:17:31 +0800
committerchriseth <chris@ethereum.org>2017-11-22 23:25:24 +0800
commite15918d8b6fd106d147d00d0c3405df88ab39b64 (patch)
treec6c72b954ce1b7ad2542f39ae7430d6df61dd98d /docs
parent6ed4e0632f18f4dc6d7c2db4c5ad6b0f64c9e225 (diff)
downloaddexon-solidity-e15918d8b6fd106d147d00d0c3405df88ab39b64.tar.gz
dexon-solidity-e15918d8b6fd106d147d00d0c3405df88ab39b64.tar.zst
dexon-solidity-e15918d8b6fd106d147d00d0c3405df88ab39b64.zip
Add if statement to Julia specification.
Diffstat (limited to 'docs')
-rw-r--r--docs/julia.rst12
1 files changed, 10 insertions, 2 deletions
diff --git a/docs/julia.rst b/docs/julia.rst
index cf798363..014cd00b 100644
--- a/docs/julia.rst
+++ b/docs/julia.rst
@@ -15,7 +15,7 @@ future versions of the Solidity compiler will even use JULIA as intermediate
language. It should also be easy to build high-level optimizer stages for JULIA.
The core components of JULIA are functions, blocks, variables, literals,
-for-loops, switch-statements, expressions and assignments to variables.
+for-loops, if-statements, switch-statements, expressions and assignments to variables.
JULIA is typed, both variables and literals must specify the type with postfix
notation. The supported types are ``bool``, ``u8``, ``s8``, ``u32``, ``s32``,
@@ -88,6 +88,8 @@ Grammar::
IdentifierList ':=' Expression
Expression =
FunctionCall | Identifier | Literal
+ If =
+ 'if' Expression Block
Switch =
'switch' Expression Case* ( 'default' Block )?
Case =
@@ -248,8 +250,14 @@ We will use a destructuring notation for the AST nodes.
G, L, break
E(G, L, continue: BreakContinue) =
G, L, continue
+ E(G, L, <if condition body>: If) =
+ let G0, L0, v = E(G, L, condition)
+ if v is true or non-zero:
+ E(G0, L0, body)
+ else:
+ G0, L0, regular
E(G, L, <switch condition case l1:t1 st1 ... case ln:tn stn>: Switch) =
- E(G, L, switch condition case l1:t1 st1 ... case ln:tn stn default {}) =
+ E(G, L, switch condition case l1:t1 st1 ... case ln:tn stn default {})
E(G, L, <switch condition case l1:t1 st1 ... case ln:tn stn default st'>: Switch) =
let G0, L0, v = E(G, L, condition)
// i = 1 .. n