mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add if statement to Julia specification.
This commit is contained in:
parent
6ed4e0632f
commit
e15918d8b6
@ -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.
|
language. It should also be easy to build high-level optimizer stages for JULIA.
|
||||||
|
|
||||||
The core components of JULIA are functions, blocks, variables, literals,
|
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
|
JULIA is typed, both variables and literals must specify the type with postfix
|
||||||
notation. The supported types are ``bool``, ``u8``, ``s8``, ``u32``, ``s32``,
|
notation. The supported types are ``bool``, ``u8``, ``s8``, ``u32``, ``s32``,
|
||||||
@ -88,6 +88,8 @@ Grammar::
|
|||||||
IdentifierList ':=' Expression
|
IdentifierList ':=' Expression
|
||||||
Expression =
|
Expression =
|
||||||
FunctionCall | Identifier | Literal
|
FunctionCall | Identifier | Literal
|
||||||
|
If =
|
||||||
|
'if' Expression Block
|
||||||
Switch =
|
Switch =
|
||||||
'switch' Expression Case* ( 'default' Block )?
|
'switch' Expression Case* ( 'default' Block )?
|
||||||
Case =
|
Case =
|
||||||
@ -248,8 +250,14 @@ We will use a destructuring notation for the AST nodes.
|
|||||||
G, L, break
|
G, L, break
|
||||||
E(G, L, continue: BreakContinue) =
|
E(G, L, continue: BreakContinue) =
|
||||||
G, L, continue
|
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>: 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) =
|
E(G, L, <switch condition case l1:t1 st1 ... case ln:tn stn default st'>: Switch) =
|
||||||
let G0, L0, v = E(G, L, condition)
|
let G0, L0, v = E(G, L, condition)
|
||||||
// i = 1 .. n
|
// i = 1 .. n
|
||||||
|
Loading…
Reference in New Issue
Block a user