Compare commits
9 Commits
testing
...
b1bf2e9688
| Author | SHA1 | Date | |
|---|---|---|---|
| b1bf2e9688 | |||
| b355760fda | |||
| d16d6bd809 | |||
| a8ac07e8ab | |||
| 8f9e8f5b25 | |||
| e0fb187a7c | |||
| d15cd17f23 | |||
| f35f908175 | |||
| 3af5f15165 |
@@ -14,7 +14,9 @@
|
|||||||
<h3>Navigation</h3>
|
<h3>Navigation</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong><a href="#core_concepts">Core Concepts</a></strong></li>
|
<li><strong><a href="#core_concepts">Core Concepts</a></strong></li>
|
||||||
<li><strong><a href="#types">Types</a></strong></li>
|
<li><strong><a href="#type_system">Type System</a></strong></li>
|
||||||
|
<li><a href="#value_types">Value Types</a></li>
|
||||||
|
<li><a href="#type_checker">Type Checker</a></li>
|
||||||
<li><strong><a href="#builtins">Built In Functions</a></strong></li>
|
<li><strong><a href="#builtins">Built In Functions</a></strong></li>
|
||||||
<li><a href="#input_string_msg__string">input(string msg) string</a></li>
|
<li><a href="#input_string_msg__string">input(string msg) string</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -44,6 +46,8 @@
|
|||||||
<li>Operators: these make up the actual logic of your program. Operators are thing like <code>+</code>, <code>=</code>, or <code>if</code>. (if and while are operators in Solstice.)</li>
|
<li>Operators: these make up the actual logic of your program. Operators are thing like <code>+</code>, <code>=</code>, or <code>if</code>. (if and while are operators in Solstice.)</li>
|
||||||
<li>Code blocks: this is the collection of values, identifiers, and operators, usually in between <code>{</code> and <code>}</code>.</li>
|
<li>Code blocks: this is the collection of values, identifiers, and operators, usually in between <code>{</code> and <code>}</code>.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h3>Comments</h3>
|
||||||
|
<p>You can type <code>//</code> to insert a comment into your program. The rest of your line will be commented out.
|
||||||
<h3>puts</h3>
|
<h3>puts</h3>
|
||||||
<p>The <code>puts</code> command in Solstice is used to print out a value. It is not a function, but a built in operator, similar to <code>+</code> or <code>=</code>.</p>
|
<p>The <code>puts</code> command in Solstice is used to print out a value. It is not a function, but a built in operator, similar to <code>+</code> or <code>=</code>.</p>
|
||||||
<p>Use it like this:</p>
|
<p>Use it like this:</p>
|
||||||
@@ -56,9 +60,8 @@ puts "You can print out anything with puts!"</code></pre>
|
|||||||
<pre class="code"><code>x = 5<br>puts x</code></pre>
|
<pre class="code"><code>x = 5<br>puts x</code></pre>
|
||||||
<p>Types are automatically inferred by Solstice.</p>
|
<p>Types are automatically inferred by Solstice.</p>
|
||||||
<h3>Maths</h3>
|
<h3>Maths</h3>
|
||||||
<p>Note: math is currently in beta. Order of Operations is harder to implement than I thought lol</p>
|
|
||||||
<p>You can use <code>+</code> (add), <code>-</code> (subtract), <code>*</code> (multiply), and <code>/</code> (divide) to do math.</p>
|
<p>You can use <code>+</code> (add), <code>-</code> (subtract), <code>*</code> (multiply), and <code>/</code> (divide) to do math.</p>
|
||||||
<p>Math operations take two values on either side, and perform the operation.</p>
|
<p>Math operations take two values on either side, and perform the operation. Order of operations is supported.</p>
|
||||||
<pre class="code"><code>x = 5 + 3<br>y = 10<br>puts x + y</code></pre>
|
<pre class="code"><code>x = 5 + 3<br>y = 10<br>puts x + y</code></pre>
|
||||||
<h3>Control Flow and Equalities</h3>
|
<h3>Control Flow and Equalities</h3>
|
||||||
<p>Solstice supports <code>if</code> and <code>while</code> statements, as well as the <code>==</code>, <code>!=</code>, <code>></code>, <code>>=</code>, <code><</code>, and <code><=</code> operations.</p>
|
<p>Solstice supports <code>if</code> and <code>while</code> statements, as well as the <code>==</code>, <code>!=</code>, <code>></code>, <code>>=</code>, <code><</code>, and <code><=</code> operations.</p>
|
||||||
@@ -72,7 +75,7 @@ if x > 10 {
|
|||||||
if x < 10 {
|
if x < 10 {
|
||||||
puts "x is smaller than 10"
|
puts "x is smaller than 10"
|
||||||
}
|
}
|
||||||
if x == 0 {
|
if x == 10 {
|
||||||
puts "x is 10"
|
puts "x is 10"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,23 +85,45 @@ while number < 10 {
|
|||||||
number = number + 1
|
number = number + 1
|
||||||
puts number
|
puts number
|
||||||
}</<code></pre>
|
}</<code></pre>
|
||||||
</code>
|
</code>
|
||||||
<h3>Calling Functions</h3>
|
<h3>Functions</h3>
|
||||||
<p>Function calling is done like in most other programming languages, with the syntax <code>function(arg1, arg2, arg3)</code>.</p>
|
<p><strong>Note:</strong> Functions in Solstice are currently in beta. Type checking for functions is currently experimental, and arguments may not work as intended. Be warned!</p>
|
||||||
<h3>That's it!</h3>
|
<p>In Solstice, function definitions have a syntax like this: <pre class="code"><code>def functionName(type arg1, type arg2, type arg3) returnType {<br> // code goes here<br>}</code></pre></p>
|
||||||
<p>You now know everything you need to know about Solstice to start programming! You can continue reading for more information.</p>
|
<p>Your types can be <code>int</code>, <code>double</code>, <code>string</code>, <code>bool</code>, or <code>char</code> (see the "Type System" section for more details)</p>
|
||||||
|
<p>Return a value (which must be the same type as your <code>returnType</code>) with <code>return value</code>.</p>
|
||||||
|
<p>Here's an example function:</p>
|
||||||
|
<pre class="code"><code>def add(int a, int b) int {
|
||||||
|
return a + b
|
||||||
|
}</code></pre>
|
||||||
|
<h3>Calling Functions</h3>
|
||||||
|
<p>Function calling is done like in most other programming languages, with the syntax <code>function(arg1, arg2, arg3)</code>.</p>
|
||||||
|
<h3>That's it!</h3>
|
||||||
|
<p>You now know everything you need to know about Solstice to start programming! You can continue reading for more information.</p>
|
||||||
</div>
|
</div>
|
||||||
<div id="types">
|
<div id="type_system">
|
||||||
<h2>Types</h2>
|
<h2>Type System</h2>
|
||||||
<p>Solstice's type system is currently a work in progress, but what is so far implemented will be detailed.</p>
|
<p>Solstice's type system is currently a work in progress, but what is so far implemented will be detailed.</p>
|
||||||
<h3>Value Types</h3>
|
<div id="value_types">
|
||||||
<ul>
|
<h3>Value Types</h3>
|
||||||
<li><code>int</code>: Signed 64 bit integer</li>
|
<ul>
|
||||||
<li><code>double</code>: Double prescision floating point number</li>
|
<li><code>int</code>: Signed 64 bit integer</li>
|
||||||
<li><code>string</code>: Character array</li>
|
<li><code>double</code>: Double prescision floating point number</li>
|
||||||
<li><code>char</code>: A single character</li>
|
<li><code>string</code>: Character array</li>
|
||||||
<li><code>bool</code>: Either true or false</li>
|
<li><code>char</code>: A single character</li>
|
||||||
</ul>
|
<li><code>bool</code>: Either true or false</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="type_checker">
|
||||||
|
<h3>Type Checker</h3>
|
||||||
|
<p>Solstice statically checks types at compile time to ensure your data is used as intended. These are the details of the type checker.</p>
|
||||||
|
<ul>
|
||||||
|
<li>Types of variables when setting with <code>=</code> are autoinferred and cannot be provided by the user. All variables must have a value.</li>
|
||||||
|
<li>When setting a variable with <code>=</code>, it's type must not mutate in any way.</li>
|
||||||
|
<li>Functions must have types annotated. There is no "any" type.</li>
|
||||||
|
<li>When using operators, integers are able to promote to doubles where required. No other types can automatically convert.</li>
|
||||||
|
<li>All equality operators require the same type on both sides of the equality.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="builtins">
|
<div id="builtins">
|
||||||
<h2>Built In Functions</h2>
|
<h2>Built In Functions</h2>
|
||||||
|
|||||||
1
docs/node_modules/.mf/cf.json
generated
vendored
Normal file
1
docs/node_modules/.mf/cf.json
generated
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"httpProtocol":"HTTP/1.1","clientAcceptEncoding":"gzip, deflate, br","requestPriority":"","edgeRequestKeepAliveStatus":1,"requestHeaderNames":{},"clientTcpRtt":12,"colo":"SYD","asn":9443,"asOrganization":"Vocus","country":"AU","isEUCountry":false,"city":"Sydney","continent":"OC","region":"New South Wales","regionCode":"NSW","timezone":"Australia/Sydney","longitude":"151.20732","latitude":"-33.86785","postalCode":"1001","tlsVersion":"TLSv1.3","tlsCipher":"AEAD-AES256-GCM-SHA384","tlsClientRandom":"daX8oL41wKEGQv5d7pl4Gz+FvxZY9qRPz8AwU1lq8WE=","tlsClientCiphersSha1":"kXrN3VEKDdzz2cPKTQaKzpxVTxQ=","tlsClientExtensionsSha1":"1eY97BUYYO8vDaTfHQywB1pcNdM=","tlsClientExtensionsSha1Le":"u4wtEMFQBY18l3BzHAvORm+KGRw=","tlsExportedAuthenticator":{"clientHandshake":"a677c57d6ea9007a40767d4e57b68c110114325d39d60b2863517e495f5fedb47b6d65db6b0b732420c3a845ebb9b7b7","serverHandshake":"290d01a7b75e9b8739f14abab625c4d18a458ef4c344c21deb141ecffdff506b7c06bd96ce86ac94b6600c255d8d6daa","clientFinished":"0635e92b7ba2caac307410878e7c35778b416890d460bf90703cc6c5ce869e41c1a62fe172c6ceffb734bbc20b41f426","serverFinished":"43843c9f186775a525ccd2c5e0769602e4572abca8075253c01eb26cb908e0c5281c55dbb3a93302a2304a7a45546e73"},"tlsClientHelloLength":"1603","tlsClientAuth":{"certPresented":"0","certVerified":"NONE","certRevoked":"0","certIssuerDN":"","certSubjectDN":"","certIssuerDNRFC2253":"","certSubjectDNRFC2253":"","certIssuerDNLegacy":"","certSubjectDNLegacy":"","certSerial":"","certIssuerSerial":"","certSKI":"","certIssuerSKI":"","certFingerprintSHA1":"","certFingerprintSHA256":"","certNotBefore":"","certNotAfter":""},"verifiedBotCategory":"","botManagement":{"corporateProxy":false,"verifiedBot":false,"jsDetection":{"passed":false},"staticResource":false,"detectionIds":{},"score":99}}
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<div class="feature-row">
|
<div class="feature-row">
|
||||||
<div class="feature">
|
<div class="feature">
|
||||||
<h3>Small and fast</h3>
|
<h3>Small and fast</h3>
|
||||||
<p>Solstice's compiler is 1216 lines of C++, and compiles code at lightning speed.</p>
|
<p>Solstice's compiler is 1833 lines of C++, and compiles code at lightning speed.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="feature">
|
<div class="feature">
|
||||||
<h3>Built on Ground</h3>
|
<h3>Built on Ground</h3>
|
||||||
|
|||||||
@@ -20,8 +20,7 @@
|
|||||||
<textarea class="code" id="editor" spellcheck="false" placeholder="Enter Solstice code here..." rows="20">
|
<textarea class="code" id="editor" spellcheck="false" placeholder="Enter Solstice code here..." rows="20">
|
||||||
puts "Hello from Solstice via WebAssembly!"
|
puts "Hello from Solstice via WebAssembly!"
|
||||||
puts "Let's do some math:"
|
puts "Let's do some math:"
|
||||||
puts 10 + 20 + 12
|
puts 10 + 20 + 12</textarea>
|
||||||
</textarea>
|
|
||||||
|
|
||||||
<div id="controls">
|
<div id="controls">
|
||||||
<button id="runBtn" style="font-size: 20px;">Loading WASM...</button>
|
<button id="runBtn" style="font-size: 20px;">Loading WASM...</button>
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user