summaryrefslogtreecommitdiff
path: root/language/l2_parse.ott
diff options
context:
space:
mode:
authorGabriel Kerneis2013-08-19 12:20:48 +0100
committerGabriel Kerneis2013-08-19 12:20:48 +0100
commit2209e971363bbd294194f9799f290b7814d1dfd6 (patch)
tree0c70fc02d0fa8625929ae33a20ddf47f902ac4b7 /language/l2_parse.ott
parent5cf0230381eab9e5b96ea9ebbdcac4cb430c4a82 (diff)
Add loops and document optionnal else in conditional
Syntax: foreach id from exp (to|downto) exp (by exp)? exp foreach and by are keywords; from, to and downto aren't.
Diffstat (limited to 'language/l2_parse.ott')
-rw-r--r--language/l2_parse.ott7
1 files changed, 7 insertions, 0 deletions
diff --git a/language/l2_parse.ott b/language/l2_parse.ott
index 4e965d7c..99465f65 100644
--- a/language/l2_parse.ott
+++ b/language/l2_parse.ott
@@ -613,6 +613,13 @@ exp :: 'E_' ::=
| if exp1 then exp2 else exp3 :: :: if
{{ com conditional }}
+ | if exp1 then exp2 :: S :: ifnoelse {{ icho [[ if exp1 then exp2 else unit ]] }}
+
+ | foreach id from exp1 to exp2 by exp3 exp4 :: :: for {{ com loop }}
+ | foreach id from exp1 to exp2 exp3 :: S :: forbyone {{ icho [[ foreach id from exp1 to exp2 by 1 exp4 ]] }}
+ | foreach id from exp1 downto exp2 by exp3 exp4 :: S :: fordown {{ icho [[ foreach id from exp1 to exp2 by ( - exp3 ) exp4 ]] }}
+ | foreach id from exp1 downto exp2 exp3 :: S :: fordownbyone {{ icho [[ foreach id from exp1 downto exp2 by 1 exp4 ]] }}
+
% vectors
| [ exp1 , ... , expn ] :: :: vector {{ com vector (indexed from 0) }}
% order comes from global command-line option???