Merge pull request 'testing' (#1) from testing into master
Reviewed-on: max/sols.dev#1
This commit was merged in pull request #1.
This commit is contained in:
BIN
docs/favicon.ico
Normal file
BIN
docs/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
80
docs/index.css
Normal file
80
docs/index.css
Normal file
@@ -0,0 +1,80 @@
|
||||
.twopane {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 5%;
|
||||
}
|
||||
|
||||
.box {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
position: sticky;
|
||||
top: 40px;
|
||||
width: 250px;
|
||||
padding: 20px;
|
||||
background: #080511;
|
||||
border-radius: 8px;
|
||||
border: 1px solid #26146b;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.sidebar h3 {
|
||||
margin-top: 0;
|
||||
margin-bottom: 1rem;
|
||||
font-size: 1.2rem;
|
||||
color: #a594f9;
|
||||
}
|
||||
|
||||
.sidebar ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.sidebar li {
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.sidebar a {
|
||||
text-decoration: none;
|
||||
color: #ccc;
|
||||
display: block;
|
||||
padding: 8px 12px;
|
||||
border-radius: 6px;
|
||||
transition: background-color 0.2s, color 0.2s;
|
||||
}
|
||||
|
||||
.sidebar a:hover {
|
||||
background-color: #26146b;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.content {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.twopane {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
top: 0;
|
||||
margin-bottom: 20px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 35px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
font-size: 25px;
|
||||
}
|
||||
115
docs/index.html
Normal file
115
docs/index.html
Normal file
@@ -0,0 +1,115 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Solstice Docs</title>
|
||||
<link rel="stylesheet" href="https://sols.dev/index.css">
|
||||
<link rel="stylesheet" href="index.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="twopane">
|
||||
<div class="sidebar">
|
||||
<h3>Navigation</h3>
|
||||
<ul>
|
||||
<li><strong><a href="#core_concepts">Core Concepts</a></strong></li>
|
||||
<li><strong><a href="#types">Types</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>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="content">
|
||||
<h1>Solstice Docs</h1>
|
||||
<p>Welcome to the Solstice docs! Feel free to read in whichever order you like, or come back when you feel like it. You can read these head to tail if you want to understand the whole of the language as well.</p>
|
||||
<p>See a mistake? Report it at <a href="https://chsp.au/max/sols.dev">this site's repository</a>.
|
||||
<p>Happy coding!</p>
|
||||
<div id="core_concepts">
|
||||
<h2>Core Concepts</h2>
|
||||
<p>Solstice is a high level programming language. It compiles to Ground's bytecode.</p>
|
||||
<h3>The <code>solstice</code> command</h3>
|
||||
<p>Solstice's compiler is invoked via the <code>solstice</code> command. It provides some options:</p>
|
||||
<ul>
|
||||
<li><code>-o</code> or <code>--output</code>: Tells Solstice where to output a compiled file.</li>
|
||||
<li><code>-t</code> or <code>--type</code>: Tells Solstice the type of file to output.<br>At present, Solstice only supports Ground source files as an output type, but more types may be added in future.</li>
|
||||
</ul>
|
||||
<p>Example usage:</p>
|
||||
<pre class="code"><code>solstice fib.sols -o fib.grnd</code></pre>
|
||||
<pre class="code"><code>solstice fib.sols</code></pre>
|
||||
<h3>Writing Solstice code</h3>
|
||||
<p>Solstice code consists of four main things: values, identifiers, operators, and code blocks.</p>
|
||||
<ul>
|
||||
<li>Values: these are your literal values in your program, like <code>"Hello!"</code>, <code>32</code>, or <code>true</code>. More on values and the Solstice type system later.</li>
|
||||
<li>Identifiers: these are names of variables. They normally hold something in them.</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>
|
||||
</ul>
|
||||
<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>Use it like this:</p>
|
||||
<pre class="code"><code>puts "Hello, World!"
|
||||
puts 3.14
|
||||
puts true
|
||||
puts "You can print out anything with puts!"</code></pre>
|
||||
<h3>Variables</h3>
|
||||
<p>Solstice variables are quite simple. Assign values with <code>=</code>, and read them with the variable name.</p>
|
||||
<pre class="code"><code>x = 5<br>puts x</code></pre>
|
||||
<p>Types are automatically inferred by Solstice.</p>
|
||||
<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>Math operations take two values on either side, and perform the operation.</p>
|
||||
<pre class="code"><code>x = 5 + 3<br>y = 10<br>puts x + y</code></pre>
|
||||
<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>Conditionals work just like maths: two values on either side, check whether the condition is correct or not based on those values, and output a boolean.</p>
|
||||
<pre class="code"><code>puts 5 == 5<br>puts 5 != 5</code></pre>
|
||||
<p><code>if</code> and <code>while</code> statements take a conditional, and then a code block afterwards. See these examples:</p>
|
||||
<pre class="code"><code>x = 5
|
||||
if x > 10 {
|
||||
puts "x is bigger than 10"
|
||||
}
|
||||
if x < 10 {
|
||||
puts "x is smaller than 10"
|
||||
}
|
||||
if x == 0 {
|
||||
puts "x is 10"
|
||||
}
|
||||
|
||||
number = 0
|
||||
|
||||
while number < 10 {
|
||||
number = number + 1
|
||||
puts number
|
||||
}</<code></pre>
|
||||
</code>
|
||||
<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 id="types">
|
||||
<h2>Types</h2>
|
||||
<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>
|
||||
<ul>
|
||||
<li><code>int</code>: Signed 64 bit integer</li>
|
||||
<li><code>double</code>: Double prescision floating point number</li>
|
||||
<li><code>string</code>: Character array</li>
|
||||
<li><code>char</code>: A single character</li>
|
||||
<li><code>bool</code>: Either true or false</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="builtins">
|
||||
<h2>Built In Functions</h2>
|
||||
<div id="input_string_msg__string">
|
||||
<h3>input(string msg) string</h3>
|
||||
<p>Gets user input from the console until the next line. The msg is used as a prompt for the user. Returns inputted characters from the console.</p>
|
||||
<pre class="code"><code>guess = input("What is the password? ")<br>if guess == "password123" {<br> puts "Good job!"<br>}</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -17,6 +17,7 @@
|
||||
<button onclick="window.location.href = 'https://chsp.au/max/solstice'">View Code</button>
|
||||
<button onclick="window.location.href = '#installing'">Install</button>
|
||||
<button onclick="window.location.href = '/playground'">Try Online</button>
|
||||
<button onclick="window.location.href = '/docs'">View Docs</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
@@ -95,6 +96,7 @@ while number < 100000 {
|
||||
<code>bash -c "$(curl -fsSL https://sols.dev/install.sh)"</code></pre>
|
||||
<p>If you find any issues while trying Solstice, please report them <a href="https://chsp.au/max/solstice/issues">here</a>! Solstice needs all the help it can get.</p>
|
||||
<p>Stable-ish builds are avaliable in <a href="https://chsp.au/max/solstice/releases">the releases tab</a> of the Git repository. These builds are likely to be more stable, but don't treat them as a stable branch yet.</p>
|
||||
<p>Once you've installed, <a href="/docs">read the docs</a> to get started.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
BIN
playground/favicon.ico
Normal file
BIN
playground/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 176 KiB |
Reference in New Issue
Block a user