Category:Onyx (wasm): Difference between revisions
Content added Content deleted
(Created page with "{{stub}}{{language|Ayrch}}") |
No edit summary |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{stub}}{{language| |
{{stub}}{{language|site=https://onyxlang.io/}} |
||
Onyx is a WebAssembly-first language (`app.wasm`). WebAssembly can be used inside of a browser but is also growing in popularity outside of the browser, in part due to projects like Wasmer, Wasmtime, and WasmEdge. These "controlled environments" could be game engines, where WASM is used as a "script" system; cloud functions, where WASM is used to respond to requests; plug-in systems for editors or tools. |
|||
Onyx uses a modernized C-like syntax, similar to Jai or Odin. Onyx is an imperative and procedural language in which statements are evaluated in the order they are written in, but does allow for functional-inspired syntax using the pipe operator. |
|||
For example: |
|||
<syntaxhighlight lang="C"> |
|||
use core { printf, iter } |
|||
main :: () { |
|||
for i in 1 .. 10 { |
|||
fact := factorial(i); |
|||
printf("{}! = {}\n", i, fact); |
|||
} |
|||
} |
|||
factorial :: (n: i32) -> i32 { |
|||
return iter.as_iter(1 .. n) |
|||
|> iter.fold(1, (x, y) => x * y); |
|||
} |
|||
</syntaxhighlight> |
Latest revision as of 01:59, 12 March 2024
Onyx (wasm)
This programming language may be used to instruct a computer to perform a task.
Listed below are all of the tasks on Rosetta Code which have been solved using Onyx (wasm).
This programming language may be used to instruct a computer to perform a task.
Official website |
---|
See Also: |
|
---|
Onyx is a WebAssembly-first language (`app.wasm`). WebAssembly can be used inside of a browser but is also growing in popularity outside of the browser, in part due to projects like Wasmer, Wasmtime, and WasmEdge. These "controlled environments" could be game engines, where WASM is used as a "script" system; cloud functions, where WASM is used to respond to requests; plug-in systems for editors or tools.
Onyx uses a modernized C-like syntax, similar to Jai or Odin. Onyx is an imperative and procedural language in which statements are evaluated in the order they are written in, but does allow for functional-inspired syntax using the pipe operator.
For example:
use core { printf, iter }
main :: () {
for i in 1 .. 10 {
fact := factorial(i);
printf("{}! = {}\n", i, fact);
}
}
factorial :: (n: i32) -> i32 {
return iter.as_iter(1 .. n)
|> iter.fold(1, (x, y) => x * y);
}
Pages in category "Onyx (wasm)"
The following 6 pages are in this category, out of 6 total.