updated: many pages and dependencies
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 5 Apr 2023 18:34:55 +0000 (13:34 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Wed, 5 Apr 2023 18:34:55 +0000 (13:34 -0500)
12 files changed:
onyx-pkg.ini
src/app.onyx
www/news-articles/ovmwasm.html [new file with mode: 0644]
www/static/css/new_style.css
www/static/vendor/highlight.min.js
www/templates/pages/404.html
www/templates/pages/docs.html
www/templates/pages/docs/install.html
www/templates/pages/homepage.html
www/templates/pages/news.html
www/templates/pages/news_article.html
www/templates/pages/normal_page.html

index 3d256dddc2c38ceeba1a772f84b75d745e5f5278..2161be100e8d56bad756a20a46f60bd9692e870c 100644 (file)
@@ -17,9 +17,9 @@ build_cmd=
 library=
 
 [dependencies]
-git://onyxlang.io/repo/http-server=0.1.19
-git://onyxlang.io/repo/postgres-orm=0.0.24
-git://onyxlang.io/repo/otmp=0.0.6
+git://onyxlang.io/repo/http-server=0.1.22
+git://onyxlang.io/repo/postgres-orm=0.0.25
+git://onyxlang.io/repo/otmp=0.0.7
 
 [dependency_folders]
 git://onyxlang.io/repo/http-server=http-server
index 50384342144df56e94ce6fe852f6956c15d4e9e3..4b977df4a979eb7124c12114578a851ff627a13f 100644 (file)
@@ -1,11 +1,14 @@
+use core {package, *}
+use runtime
+use otmp
+use http
+use http.server {Req :: Request, Res :: Response, route}
+
 #inject runtime.vars {
     Enable_Heap_Debug :: true
     Debug :: true
 }
 
-use core
-use http.server {Req :: Request, Res :: Response, route}
-
 reg: otmp.TemplateRegistry;
 #inject Res {
     render :: (r: &Res, template: str, vars: any) {
@@ -20,6 +23,12 @@ reg: otmp.TemplateRegistry;
     res->render("pages/homepage", null);
 }
 
+
+@route.{.GET, "/ovmwasm"}
+(req: &Req, res: &Res) {
+    res->render("pages/ovmwasm", null);
+}
+
 @route.{.GET, "/docs"}
 (req: &Req, res: &Res) {
     res->render("pages/docs", null);
@@ -30,33 +39,38 @@ reg: otmp.TemplateRegistry;
     res->render("pages/docs/install", null);
 }
 
-@route.{.GET, "/news"}
+@route.{.GET, "/news/:article"}
 (req: &Req, res: &Res) {
-    if a := req.query->get_opt("a"); a {
-        filename := tprintf("www/news-articles/{}.html", a.value);
-        if os.file_exists(filename) {
-            article := os.get_contents(filename);
-            defer delete(&article);
-
-            res->render("pages/news_article", &.{
-                article = article
-            });
-        }
+    // TODO: Safety / error checking here
+    filename := tprintf("www/news-articles/{}.html", req.url_params["article"]);
+
+    if os.file_exists(filename) {
+        article := os.get_contents(filename);
+        defer delete(&article);
+
+        res->render("pages/news_article", &.{
+            article = article
+        });
 
     } else {
-        articles := make([..] str);
+        res->status(404);
+    }
+}
 
-        for os.list_directory("www/news-articles") {
-            name := it->name();
-            if string.ends_with(name, ".html") {
-                articles << string.temp_copy(name[0 .. name.length-5]);
-            }
-        }
+@route.{.GET, "/news"}
+(req: &Req, res: &Res) {
+    articles := make([..] str);
 
-        res->render("pages/news", &.{
-            articles = articles
-        });
+    for os.list_directory("www/news-articles") {
+        name := it->name();
+        if string.ends_with(name, ".html") {
+            articles << string.temp_copy(name[0 .. name.length-5]);
+        }
     }
+
+    res->render("pages/news", &.{
+        articles = articles
+    });
 }
 
 main :: () {
@@ -89,7 +103,7 @@ main :: () {
     logger := http.server.logger();
     app->pipe(&logger);
 
-    app->serve(8080);
+    app->serve(8081);
     println("Server stopping...");
 }
 
diff --git a/www/news-articles/ovmwasm.html b/www/news-articles/ovmwasm.html
new file mode 100644 (file)
index 0000000..834dc50
--- /dev/null
@@ -0,0 +1,35 @@
+<div class="container">
+    <h1>Onyx's Custom Runtime</h1>
+
+    <p>
+        As Onyx targets WebAssembly (WASM) exclusively, running code outside of the browser requires a <a href="https://webassembly.github.io/spec/core/appendix/embedding.html">WASM embedder</a>.
+        The job of the embedder is to translate the WASM Virtual Instruction Set Architecture into a "real" architecture that can be executed on the host system.
+        There are many great WASM embedders that exist for running WASM outside the browser. Here's a small, non-comprehensive list:
+    </p>
+    <ul>
+        <li><a href="https://wasmer.io">Wasmer</a></li>
+        <li><a href="https://wasmtime.dev">Wasmtime</a></li>
+        <li><a href="https://github.com/wasm3/wasm3">Wasm3</a></li>
+        <li><a href="https://wasmedge.org">WasmEdge</a></li>
+    </ul>
+
+    <p>
+    All of these embedders are great in their own way, but the one thing they are not <em>great</em> at is providing a great developer experience for Onyx. For this reason, Onyx maintains support for two WASM embedders: <em>Wasmer</em> and <em>OVM-Wasm</em>. Wasmer is used as the faster, production-ready embedder, while OVM-Wasm is used as the development embedder.
+    </p>
+
+    <p>
+    OVM-Wasm stands for <em>Onyx Virtual Machine for WASM</em>. The Onyx Virtual Machine (OVM) started as a separate project with the goal of providing a separate compile-target for Onyx; however, to reduce complexity, OVM-Wasm was created as a wrapper around OVM, that provides a <a href="https://github.com/WebAssembly/wasm-c-api">wasm-c-api</a> compatible interface, making it a WASM embedder.
+    Since OVM-Wasm is entirely specific to Onyx and can be easily modified to suit the needs of developing Onyx.
+    It has more features compared to a normal WASM embedder, such a <em>debugging interface</em> that is compatible with the Debug Adapter Protocol.
+    </p>
+    
+    <p>
+    Currently, it does not run as fast as it could.
+    This is due to several reason, but largely because it simply compiles WebAssembly down to an <em>interpreted</em> instruction stream, not machine-native instructions.
+    This was done to make OVM-Wasm more portable, but does come at a significant performance cost.
+    To compound onto this fact, the instruction stream itself is not optimized <em>at all</em>.
+    It is the most literal, WASM to OVM conversion possible.
+    This helps make the initial startup time faster, but does incur wasted performance.
+    It is on the (rather large) list of to-dos to add simple optimizations to the embedding process to make OVM-Wasm not <em>horribly</em> slow.
+    </p>
+</div>
index 5d9af0035e34f5eece9b345dc22f46c6598695c6..6db2f8ab5e495560bf1d8c5afb4f36d11bf0eca4 100644 (file)
@@ -62,6 +62,14 @@ a:visited {
     margin: 0 auto;
 }
 
+.container > p {
+    margin-top: 20px;
+}
+
+.container ul {
+    padding-left: 20px;
+}
+
 .container.center {
     display: flex;
     justify-content: center;
@@ -102,6 +110,7 @@ code {
 /* Nagivation */
 .navbar-container {
     max-width: 1200px;
+    width: 1200px;
     margin: 0 auto;
 }
 
@@ -187,3 +196,10 @@ navbar a {
     text-align: justify;
 }
 
+
+main {
+    min-height: 100vh;
+    display: grid;
+    grid-template-rows: auto 1fr auto;
+}
+
index 6ed9a7a5cf3d0475bc8de60f4887652f02b51958..5f9e6668dc3e6938216076b4328d60d465b39cfd 100644 (file)
@@ -2579,10 +2579,10 @@ var hljs = (function () {
                     "for", "while", "do",
                     "switch", "case",
                     "break", "continue", "return", "defer", "fallthrough",
-                    "as", "cast", "sizeof", "alignof", "typeof"
+                    "cast", "sizeof", "alignof", "typeof"
                 ],
                 literal: "true false null null_proc null_str",
-                type: "i8 u8 i16 u16 i32 u32 i64 u64 f32 f64 rawptr str cstr i8x16 i16x8 i32x4 i64x2 f32x4 f64x2 v128 type_expr any",
+                type: "i8 u8 i16 u16 i32 u32 i64 u64 f32 f64 rawptr str cstr dyn_str i8x16 i16x8 i32x4 i64x2 f32x4 f64x2 v128 type_expr any",
                 built_in: "math map set array random iter list conv type_info",
             },
 
index 0d5307b6f1d1f64168ff9e402acd81dc7e5080e7..42b205672c959a515333620ea40aaf310e390080 100644 (file)
@@ -1,8 +1,8 @@
 {{block "content"}}
 
-{% partial "partials/navbar" %}
-
 <main>
+    {% partial "partials/navbar" %}
+
     <div class="container">
         <h1>404 - Page not found</h1>
     </div>
index 2282374d3ea8cf40b9f0ea4e46cb27be385de89e..d791f2a507beb9e075941240591e6003e971527d 100644 (file)
@@ -6,8 +6,11 @@
     <ul>
         <li><a href="/docs/install">Installation</a></li>
         <li>Getting Started</li>
-        <li>Language Reference</li>
-        <li>Useful Packages</li>
+        <li>Language Reference Book</li>
+        <li>Packages</li>
+        <ul>
+            <li><a href="https://docs.onyxlang.io/packages/core">Core packages</a></li>
+        </ul>
     </ul>
     
 </div>
index cf3233ba55edbd75a58b6cbecabc163efc43c9cc..95e01ed6d25fb0e756fe3a5f8d591fabeb162a3c 100644 (file)
@@ -2,26 +2,39 @@
 
 <div class="container">
     <h1>Installing Onyx</h1>
+    <p>
+        <a href="#online">Online</a>
+        <a href="#linux">Linux</a>
+        <a href="#windows">Windows</a>
+        <a href="#macos">MacOS</a>
+    </p>
 </div>
 
-<div class="container light">
+<div class="container light" id="online">
     <h2>Try Online</h2>
     <p>
         Onyx is available to try online for free in <a href="/playground/">Onyx Playground</a>.
-        It allows you learn the syntax from examples, without installing the language.
+        It allows you learn the syntax from examples, without installing the language onto your system.
     </p>
 </div>
 
-<div class="container">
+<div class="container" id="linux">
     <h2>Linux</h2>
+    <p>
+    </p>
 </div>
 
-<div class="container">
+<div class="container" id="windows">
     <h2>Windows</h2>
+    <p>
+    </p>
 </div>
 
-<div class="container">
+<div class="container" id="macos">
     <h2>MacOS</h2>
+    <p>
+    MacOS support is not being actively worked on at the moment. In theory, if the compiler would work on MacOS, WebAssembly binaries would have no problem running using Wasmer, Wasmtime, or a similar runtime. Onyx is always open for contributions from others on its <a href="https://github.com/onyx-lang/onyx/pulls">pull requests</a>.
+    </p>
 </div>
 
 
index 2738a2a82c72fb9ed0bd6d313f014bcdca3ed8af..8ca5ca974da5a905baff4eea9fc6d56a08b5ef11 100644 (file)
         <ul style="font-size: larger;">
             <li>Runs everywhere using <a href="https://webassembly.org">WebAssembly</a></li>
             <li>Fast compilation times (300,000+ lines / second)</li>
-            <li>Self-hosted, debuggable runtime using <a href="/ovmwasm">OVM-Wasm</a></li>
+            <li>Self-hosted, debuggable runtime using <a href="/news/ovmwasm">OVM-Wasm</a></li>
             <li>Secure runtime using <a href="https://wasmer.io">Wasmer</a></li>
         </ul>
     </div>
 
-    <pre class="hljs" style="overflow-y: scroll; width: 40%; border: 2px solid black; padding: 8px; display: block"><code class="language-onyx">use core
+    <pre class="hljs" style="overflow-y: scroll; width: 40%; border: 2px solid black; padding: 8px; display: block"><code class="language-onyx">use core {println}
 
 main :: () {
     f := factorial(10);
@@ -45,7 +45,7 @@ factorial :: (n: i32) -> i32 {
     <div class="panel-container">
         <div>
             <h3>Portable</h3>
-            <p>By targetting WASM, Onyx can used in the browser, or natively with a custom runtime.</p>
+            <p>By targetting WASM, Onyx can be used in the browser, or natively with a <a href="/news/ovmwasm">custom runtime</a>.</p>
         </div>
         <div>
             <h3>Data-Oriented</h3>
index a715cdd438d9f3eb260139d8a15755b5ba573ed3..3a2022a746f1d533057e73294786359c206b05d1 100644 (file)
@@ -6,7 +6,7 @@
     <ul>
         {{ foreach $article in $articles }}
         <li>
-            <a href="/news?a={% $article %}">{% $article %}</a>
+            <a href="/news/{% $article %}">{% $article %}</a>
         </li>
         {{ endforeach }}
     </ul>
index e4c63d099fb763391f675a2823b9e5ef99a1a1cc..db9362fa159c0e804512dd4d393c99970cf29edc 100644 (file)
@@ -1,8 +1,8 @@
 {{block "content"}}
 
-{% partial "partials/navbar" %}
-
 <main>
+    {% partial "partials/navbar" %}
+
     <div class="container">
         {% $article %}
     </div>
index 076e68405bcdecb035290badec1520c9017984d4..96e6d61eefe1939f4d4dc4185023ddd39eaafca2 100644 (file)
@@ -2,7 +2,9 @@
 
 <main>
 {% partial "partials/navbar" %}
-{% block "page_content" %}
+<div>
+    {% block "page_content" %}
+</div>
 {% partial "partials/footer" %}
 </main>