You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h2>Types<aclass="headerlink" href="#types" title="Permalink to this headline">¶</a></h2>
76
76
<p>The only primitive type in the language is the integer type <codeclass="docutils literal notranslate"><spanclass="pre">Int</span></code>.
77
77
The size of this type is unspecified, the default implementation is 64-bit integers.</p>
78
-
<p>There is not a distinct boolean type, non-zero integer values evaluate as true, and <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> evaluates as false.</p>
78
+
<p>There is not a distinct boolean type, non-zero integer values evaluate as true, and zero evaluates as false.</p>
79
79
<p>Users can define one-dimensional arrays and structs.</p>
80
80
<p>Arrays and structs are implicitly reference types, i.e. instances of these types are
81
81
allocated on the heap.</p>
82
82
<p>The language does not specify whether the heap is garbage collected or manually managed, it is
83
83
up to the implementation.</p>
84
84
<p>A <codeclass="docutils literal notranslate"><spanclass="pre">struct</span></code> type is a named aggregate with one or more fields. Fields may of be of any supported
85
-
type.</p>
85
+
type. Struct types are nominal, i.e. each struct type is identified uniquely by its name.
86
+
Multiple definitions of a struct type are not allowed.</p>
86
87
<p>An array type is declared by enclosing the element type in brackets, i.e. <codeclass="docutils literal notranslate"><spanclass="pre">[</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">]</span></code>.</p>
87
88
<p>There is a <codeclass="docutils literal notranslate"><spanclass="pre">Null</span></code> type, with a predefined literal named <codeclass="docutils literal notranslate"><spanclass="pre">null</span></code> of this type.</p>
88
89
<p>When declaring fields or variables of reference types, user may suffix the type name with <codeclass="docutils literal notranslate"><spanclass="pre">?</span></code> to
@@ -100,16 +101,14 @@ <h2>Types<a class="headerlink" href="#types" title="Permalink to this headline">
100
101
}
101
102
</pre></div>
102
103
</div>
103
-
<p>Struct types are nominal, i.e. each struct type is identified uniquely by its name.
104
-
Multiple definitions of struct types is not allowed.</p>
105
104
<p>The language does not require forward declarations.</p>
106
105
</section>
107
106
<sectionid="functions">
108
107
<h2>Functions<aclass="headerlink" href="#functions" title="Permalink to this headline">¶</a></h2>
109
108
<p>Users can declare functions, each function must have a unique name.</p>
110
-
<p>Polymorphic functions are not supported.</p>
109
+
<p>Functions cannot be overloaded. Functions are not closures.</p>
111
110
<p>Functions can accept one or more arguments and may optionally return a result.</p>
112
-
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">func</span></code> keyword instroduces a function declaration.</p>
111
+
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">func</span></code> keyword introduces a function declaration.</p>
@@ -130,6 +129,10 @@ <h2>Functions<a class="headerlink" href="#functions" title="Permalink to this he
130
129
</pre></div>
131
130
</div>
132
131
</section>
132
+
<sectionid="literals">
133
+
<h2>Literals<aclass="headerlink" href="#literals" title="Permalink to this headline">¶</a></h2>
134
+
<p>The only literals are integer values and <codeclass="docutils literal notranslate"><spanclass="pre">null</span></code>.</p>
135
+
</section>
133
136
<sectionid="variables-and-fields">
134
137
<h2>Variables and Fields<aclass="headerlink" href="#variables-and-fields" title="Permalink to this headline">¶</a></h2>
135
138
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">var</span></code> keyword is used to introduce a new variable in the current lexical scope,
@@ -181,10 +184,10 @@ <h2>Creating new instances of structs<a class="headerlink" href="#creating-new-i
181
184
</section>
182
185
<sectionid="control-flow">
183
186
<h2>Control Flow<aclass="headerlink" href="#control-flow" title="Permalink to this headline">¶</a></h2>
184
-
<p>The language is lexically scoped, and block structured.</p>
187
+
<p>The language is block structured.</p>
185
188
<p>A block is enclosed in <codeclass="docutils literal notranslate"><spanclass="pre">{</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">}</span></code> and introduces a lexical scope.</p>
186
189
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">if</span></code> statement allows branching based on a condition. The condition must be an
187
-
integer expression; a value of <codeclass="docutils literal notranslate"><spanclass="pre">0</span></code> is false, any other value is <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>.</p>
190
+
integer expression; a value of zero is <codeclass="docutils literal notranslate"><spanclass="pre">false</span></code>, any other value is <codeclass="docutils literal notranslate"><spanclass="pre">true</span></code>.</p>
188
191
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">if</span></code> statement can have an optional <codeclass="docutils literal notranslate"><spanclass="pre">else</span></code> branch.</p>
189
192
<p>The only looping construct is the <codeclass="docutils literal notranslate"><spanclass="pre">while</span></code> statement; this executes the sub statement
190
193
as long as the supplied condition evaluates to a non zero value.</p>
@@ -277,16 +280,17 @@ <h2>Grammar<a class="headerlink" href="#grammar" title="Permalink to this headli
0 commit comments