}
dependencies {
- http-server "0.3.1" git="https://github.com/onyx-lang/pkg-http-server"
+ http-server "0.3.5" git="https://github.com/onyx-lang/pkg-http-server"
otmp "0.0.36" git="https://github.com/onyx-lang/pkg-otmp"
}
target "site.wasm"
runtime "wasi"
source "build.onyx"
+ args "--multi-threaded"
define "WASIX" "CGI_MODE"
}
}
--footer-color: linear-gradient(var(--background), var(--accent-background));
--text: #ffffff;
- --background: #060609;
+ --background: #0b0b12;
--accent-background: #181824;
--primary: #45476e;
--secondary: #494957;
}
.container.card > * {
- background: linear-gradient(135deg, #000, var(--accent-background));
- box-shadow: 0px 5px 24px 12px rgba(150, 150, 230, 0.2);
+ background: linear-gradient(135deg, var(--background), var(--accent-background));
+ box-shadow: 0px 3px 16px 8px rgba(150, 150, 230, 0.2);
border-radius: 8px;
border: 1px solid var(--primary);
padding: 8px;
font-size: 3rem;
}
+h2:not(:first-child) {
+ padding-top: 3rem;
+}
+
h2 {
font-size: 2rem;
}
navbar a span {
display: inline-block;
- padding: 12px 24px;
+ margin: 4px;
+ padding: 8px 20px;
transition: all 0.3s;
+ border-radius: 4px;
}
navbar a span.active {
navbar a span:hover {
cursor: pointer;
background-color: var(--header-accent);
+ box-shadow: 0px 3px 16px 8px rgba(150, 150, 230, 0.2);
}
navbar a:visited {
}
main pre {
- background: linear-gradient(135deg, #000, var(--accent-background));
+ background: linear-gradient(135deg, var(--background), var(--accent-background));
border: 1px solid var(--primary);
border-radius: 6px;
- box-shadow: 0px 5px 24px 12px rgba(150, 150, 230, 0.2);
+ box-shadow: 0px 3px 16px 8px rgba(150, 150, 230, 0.2);
padding: 8px;
display: block;
overflow-y: auto;
}
.scrollport > * {
- margin-top: 6em;
+ margin-top: 4em;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ gap: 32px;
}
-/*
-@media screen and (min-width: 800px) {
- .scrollport {
- mask-image: linear-gradient(to right, #0000 0, #000 10%, #000 90%, #0000 100%);
- -webkit-mask-image: linear-gradient(to right, #0000 0, #000 10%, #000 90%, #0000 100%);
-
- overflow-x: auto;
- overscroll-behavior-x: contain;
-
- display: flex;
- gap: 100px;
- align-items: start;
- padding: 0 100px;
- padding-bottom: 32px;
- }
-
- .scrollport > div {
- min-width: 1000px;
- }
+.scrollport > * > * {
+ min-width: 500px;
+ flex: 1;
}
-*/
+
table {
border-radius: 8px;
border: 1px solid var(--accent);
width: 100%;
background: linear-gradient(135deg, #000, var(--accent-background));
- box-shadow: 0px 5px 24px 12px rgba(150, 150, 230, 0.2);
+ box-shadow: 0px 3px 16px 8px rgba(150, 150, 230, 0.2);
margin-top: 24px !important;
}
<h1>The <b>Onyx</b> Programming Language</h1>
</div>
<div style="font-size: 20pt; text-align: center; margin-top: 8px">
- <p>A data-oriented, expressive, and modern programming language</p>
+ <p>A type-safe, expressive, and data-oriented programming language</p>
</div>
</div>
</div>
<div>
- <div>
- <h2>Type Safety</h2>
- <br />
- <p>Onyx is <b>strictly</b> type-checked. However, the type-inference systems in Onyx usually allow you to omit types.</p>
- </div>
-
<pre class="hljs"><code class="language-onyx">use core { printf }
main :: () {
// Function with entirely inferred types.
change_value :: x => x + 10;
- // Onyx figures out the types of `change_value` when you call it.
+ // Onyx figures out the types of
+ // `change_value` when you call it.
printf("The value is {}.\n", change_value(x));
}
</code></pre>
+ <div>
+ <h2>Type Safety</h2>
+ <br />
+ <p>Onyx is <b>strictly</b> type-checked. However, the type-inference systems in Onyx usually allow you to omit types.</p>
+ </div>
+
</div>
<div>
<p>Onyx's compiler is written entirely in C and features incredibly fast compilation. The web-server for this website was compiled in <b>47 milliseconds</b>.</p>
</div>
- <pre class="hljs"><code class="language-sh">$ onyx build -V -r wasi -DWASIX -o site.wasm build.onyx
+ <pre class="hljs"><code class="language-sh">$ onyx build -V build.onyx
+
File search path:
/home/brendan/.onyx
.
Statistics:
Time taken: 47.000000 ms
- Processed 22144 lines (471148.937500 lines/second).
- Processed 115240 tokens (2451915.000000 tokens/second).
+ Processed 22144 lines
+ Processed 115240 tokens
Outputting to WASM file: site.wasm</code></pre>
</div>
<div>
- <div>
- <h2>WebAssembly</h2>
- <br />
- <p>Onyx compiles solely to <a href="https://webassembly.org">WebAssembly</a>. You can use a builtin WebAssembly runtime using <code>onyx run</code>, or compile to WASM and run using a WebAssembly runner, like Wasmer or Wasmtime.</p>
- </div>
-
<pre class="hljs"><code># Compile and run directly.
$ onyx run hello.onyx
Hello, World!
$ wasmer run hello.wasm
Hello, World!
</code></pre>
+
+ <div>
+ <h2>WebAssembly</h2>
+ <br />
+ <p>Onyx compiles solely to <a href="https://webassembly.org">WebAssembly</a>. You can use a builtin WebAssembly runtime using <code>onyx run</code>, or compile to WASM and run using a WebAssembly runner, like Wasmer or Wasmtime.</p>
+ </div>
+
</div>
<div>
<div>
<h2>C-FFI</h2>
<br />
- <p>Onyx features built-in support for linking to native C-libraries.</p>
+ <p>Onyx features built-in support for linking to native C-libraries on Linux and MacOS.</p>
</div>
<pre class="hljs"><code class="language-onyx">use core {*}
-// Using #dyncall dynamically loads the library at runtime.
+// Using #dyncall dynamically loads
+// the library at runtime using dlopen().
#foreign #dyncall "libc.so" {
- write :: (fd: i32, data: [&] u8, count: i32) -> i32 ---
+ write :: (fd: i32, msg: [] u8) -> i32 ---
}
main :: () {
msg: [] u8 = "Hello, libc!";
- write(1, msg.data, msg.length);
+ write(1, msg);
}</code></pre>
</div>
+</div>
-<div>
- <div>
- <h2>More examples</h2>
- <br />
- <p>See more complete examples on the <a href="/examples">Examples</a> page.</p>
+<div class="container">
+ <div class="title">
+ <h2>Examples</h2>
</div>
-</div>
+ <p>Learn more from complete examples on the <a href="/examples">Examples</a> page.</p>
</div>
<div class="container">
canvas.width = rect.width;
canvas.height = rect.height;
- ctx.fillStyle = '#060609';
+ ctx.fillStyle = '#0b0b12';
ctx.fillRect(0, 0, rect.width, rect.height);
}
if (y > 11 && (y + x % 11 + x % 3) - 16 > x % 6) continue;
let v = noise.get(x / 10, y / 10, Date.now() / 2500) * 3 - 1.5;
- let r = 6 * (1 - v) + 56 * v;
+ let r = 12 * (1 - v) + 60 * v;
+ r = Math.max(12, Math.min(60, r));
drawHex(x, y, `rgba(${r}, ${r}, ${r * 1.5}, 1)`);
}
}
<g id="layer1">
<path
id="path31"
- style="fill:#4d4d4d;fill-rule:evenodd;stroke-width:0.0293746"
+ style="fill:#40404d;fill-rule:evenodd;stroke-width:0.0293746"
d="M 11.763289,3.914572 1.3881028,9.8522703 a 0.10746311,0.10746311 90.000426 0 0 -1.4e-6,0.1865377 l 4.9883072,2.854897 A 0.32624697,0.32624697 164.99998 0 0 6.8203814,12.774742 L 11.900221,4.0525466 A 0.10062399,0.10062399 45.217132 0 0 11.763289,3.914572 Z" />
<path
id="path537"
- style="fill:#333333;fill-rule:evenodd;stroke-width:0.029419"
+ style="fill:#2d2d33;fill-rule:evenodd;stroke-width:0.029419"
d="M 12.162827,4.0018649 6.9729475,12.886067 a 0.0504192,0.0504192 45.290639 0 0 0.068524,0.06922 l 5.1227994,-2.923284 a 0.32119605,0.32119605 120.14455 0 0 0.162004,-0.2789709 l 0,-5.7069276 a 0.08771164,0.08771164 15.146085 0 0 -0.163448,-0.044243 z" />
<path
id="path1180"
- style="fill:#999999;fill-rule:evenodd;stroke-width:0.0295315"
+ style="fill:#929299;fill-rule:evenodd;stroke-width:0.0295315"
d="m 1.0890783,3.6985577 v 5.6525366 a 0.22068576,0.22068576 30.240095 0 0 0.329423,0.1920375 L 11.783187,3.6743435 a 0.08679074,0.08679074 75.240095 0 0 -0.04276,-0.1623148 l -10.4648157,0 a 0.18652896,0.18652896 135 0 0 -0.186529,0.186529 z" />
<path
id="path1062"
- style="fill:#4d4d4d;fill-rule:evenodd;stroke-width:0.029571"
+ style="fill:#40404d;fill-rule:evenodd;stroke-width:0.029571"
d="M 6.4864206,0.28046515 1.4340775,3.1336232 a 0.08682156,0.08682156 75.272862 0 0 0.042693,0.1624213 H 11.967016 a 0.04985456,0.04985456 104.72714 0 0 0.02452,-0.093265 L 6.8167272,0.28046515 a 0.33586257,0.33586257 6.6844583e-7 0 0 -0.3303066,0 z" />
<path
- style="fill:#ffffff;stroke-width:0.109606"
+ style="fill:#ddddff;stroke-width:0.109606"
id="path67"
d="m 46.304138,13.61792 -1.100363,0.615114 -1.082886,-0.645386 0.01748,-1.2605 1.100363,-0.615113 1.082886,0.645385 z"
transform="matrix(0.14795386,0,0,0.14795386,5.4827192,1.6710591)" />