shithub: mc

Download patch

ref: 0eb1435e594590054c25ebc9c674c397553d8393
parent: 4f9a890e8007fc30b768415c42dfa8cd76057055
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jan 14 17:32:15 EST 2017

Clarify block scoping.

--- a/doc/lang.txt
+++ b/doc/lang.txt
@@ -381,14 +381,33 @@
             stmt:       goto | break | continue | retexpr | label |
                         ifstmt | forstmt | whilestmt | matchstmt
 
-        Blocks are the basic building block of functionality in Myrddin.
-        They are simply sequences of statements that are completed one after
-        the
+        Blocks are the basic building block of functionality in Myrddin.  They
+        are simply sequences of statements that are completed one after the
+        other. They are generally terminated by a double semicolon (";;"),
+        although they may be terminated by keywords if they are part of a more
+        complex control flow construct.
 
+        Any declarations within the block are scoped to within the block,
+        and are not accessible outside of it. Their storage duration is
+        limited to within the block, and any attempts to access the associated
+        storage (via pointer, for example) is not valid.
+
     4.3. Control Constructs:
 
-            if          for
-            while       match
+            ifstmt:     "if" cond "\n" blockbody
+                        ("elif" blockbody)*
+                        ["else" blockbody] ";;"
+
+            forstmt:    foriter | foreach
+            foreach:    "for" pattern "in" expr "\n" block
+            foriter:    "for" init "\n" cond "\n" step "\n" block
+
+            whilestmt:  "while" cond "\n" block
+
+            matchstmt:  "match" expr "\n" matchpat* ";;"
+            matchpat:   "|" pat ":" blockbody
+
+            
             goto
 
         The control statements in Myrddin are similar to those in many other