diff --git a/README.md b/README.md index ea8e5eff..024e03e0 100644 --- a/README.md +++ b/README.md @@ -52,11 +52,13 @@ Sage is very portable -- run it on your thermostat! Here's the complete list of The compiler can target this limited instruction "core" set, with an expanded "standard" instruction set for floating point operations and foreign functions. The core instruction set is designed to be as simple as possible for anyone to implement their own backend. [Try to see if you can implement it yourself for your backend of choice!](https://github.com/adam-mcdaniel/sage/blob/main/src/targets/c.rs) +The core instruction set is a "zero address code" IR, unlike the popular ["three address code"](https://en.wikipedia.org/wiki/Three-address_code) LLVM IR, but it's still possible to apply single static assignment to it due to the organization of the brainf***-like tape operations. This makes the instruction set capable of applying LLVM's optimizations while being simple to implement. + ## How useful is Sage? Sage is a very young project, and is not ready for production. It's still possible to write very useful programs in it, though. -[SageOS is an operating system with a userspace written in Sage.](https://github.com/adam-mcdaniel/sage-os). The graphical shell and powerpoint presentation app (both written in Sage) use the FFI to draw to the screen, receive input from the mouse and keyboard, and interact with the filesystem. [You can look at the shell code here.](https://github.com/adam-mcdaniel/sage/tree/main/examples/sage-os/shell.sg) +[SageOS is an operating system with a userspace written in Sage.](https://github.com/adam-mcdaniel/sage-os) Its graphical shell and powerpoint presentation app (both written in Sage) use the FFI to draw to the screen, receive input from the mouse and keyboard, and interact with the filesystem. [You can look at the shell code here.](https://github.com/adam-mcdaniel/sage/tree/main/examples/sage-os/shell.sg) ![Shell1](assets/shell1.png) ![Shell2](assets/shell2.png) @@ -128,6 +130,10 @@ $ ./out - [ ] A package manager - [ ] AST Macros +## Where can I learn more? + +You can read [my blog post](https://adam-mcdaniel-blog.github.io/compilers-for-the-future) about the programming language to learn more about the implementation! + ## How do I contribute? If you want to contribute, you can open an issue or a pull request. [Adding backends for other architectures is a great way to contribute!](https://github.com/adam-mcdaniel/sage/blob/main/src/targets/c.rs) diff --git a/docs/sage/constant.LOGO.html b/docs/sage/constant.LOGO.html index 61e7ac3b..369220d9 100644 --- a/docs/sage/constant.LOGO.html +++ b/docs/sage/constant.LOGO.html @@ -1,4 +1,4 @@ -LOGO in sage - Rust

Constant sage::LOGO

source ·
pub const LOGO: &str = r#"
+LOGO in sage - Rust

Constant sage::LOGO

source ·
pub const LOGO: &str = r#"
    █████   ██████    ███████  ██████   `-.        _.-'
   ███░░   ░░░░░███  ███░░███ ███░░███   \ `,    .'/.'
  ░░█████   ███████ ░███ ░███░███████     \`.`. :.-'.-= .-'/
diff --git a/docs/sage/constant.LOGO_WITH_COLOR.html b/docs/sage/constant.LOGO_WITH_COLOR.html
index 15a4ba77..054050e6 100644
--- a/docs/sage/constant.LOGO_WITH_COLOR.html
+++ b/docs/sage/constant.LOGO_WITH_COLOR.html
@@ -1,4 +1,4 @@
-LOGO_WITH_COLOR in sage - Rust

Constant sage::LOGO_WITH_COLOR

source ·
pub const LOGO_WITH_COLOR: &str = "\x1b[32m
+LOGO_WITH_COLOR in sage - Rust

Constant sage::LOGO_WITH_COLOR

source ·
pub const LOGO_WITH_COLOR: &str = "\x1b[32m
    █████   ██████    ███████  ██████   `-.        _.-'
   ███░░   ░░░░░███  ███░░███ ███░░███   \\ `,    .'/.'
  ░░█████   ███████ ░███ ░███░███████     \\`.`. :.-'.-= .-'/
diff --git a/docs/sage/constant.NULL.html b/docs/sage/constant.NULL.html
index 1e740aca..9544b503 100644
--- a/docs/sage/constant.NULL.html
+++ b/docs/sage/constant.NULL.html
@@ -1,4 +1,4 @@
-NULL in sage - Rust

Constant sage::NULL

source ·
pub const NULL: i64 = _; // -128i64
Expand description

The value of the NULL pointer constant.

+NULL in sage - Rust

Constant sage::NULL

source ·
pub const NULL: i64 = _; // -128i64
Expand description

The value of the NULL pointer constant.

I’ve chosen to use the smallest value that can be expressed by an 8-bit signed integer. This is because I want to make sure that this works with 8-bit machines as well. The value of this constant might change in the future though.

diff --git a/docs/sage/index.html b/docs/sage/index.html index e4a5073a..fbe678d1 100644 --- a/docs/sage/index.html +++ b/docs/sage/index.html @@ -1,16 +1,14 @@ -sage - Rust

Crate sage

source ·
Expand description

The Sage Programming Language

+sage - Rust

Crate sage

source ·
Expand description

The Sage Programming Language

+

🌿🌱sage🪴🍃

+

+ Sage advice for your coding conundrums! +

+

+ + +

+

🚧 🏗️ ⚠️ This language is under construction! ⚠️ 🏗️ 🚧

-
  █████   ██████    ███████  ██████   `-.        _.-'
- ███░░   ░░░░░███  ███░░███ ███░░███   \ `,    .'/.'
-░░█████   ███████ ░███ ░███░███████     \`.`. :.-'.-= .-'/
- ░░░░███ ███░░███ ░███ ░███░███░░░       `-.:/o  .'-'/ .'
- ██████ ░░████████░░███████░░██████         o\o / ._/.'
-░░░░░░   ░░░░░░░░  ░░░░░███ ░░░░░░            \| /o|\`.
-                   ███ ░███                    |'o `.`.'.
-                  ░░██████                           `--'
-                   ░░░░░░            
-
-

Logo

(The sage compiler itself can be compiled to web assembly to be executed on the web. This allows a sage compiler + interpreter to be hosted on a static web page and run embedded sage scripts. This web implementation compiles sage LIR code into sage virtual machine code, and then feeds it to a builtin virtual machine interpreter. The compiler can also switch to various backends, such as the C source code generator, or assembly output.)

This crate implements a compiler for the sage programming language diff --git a/docs/src/sage/lib.rs.html b/docs/src/sage/lib.rs.html index 1cf97ec3..d6c749b4 100644 --- a/docs/src/sage/lib.rs.html +++ b/docs/src/sage/lib.rs.html @@ -114,26 +114,20 @@ 114 115 116 -117 -118 -119

//! # The Sage Programming Language
 //!
-//! 🚧 🏗️ ⚠️ This language is under construction! ⚠️ 🏗️ 🚧
+//! <div align="center">
+//!   <h1>🌿🌱<b>sage</b>🪴🍃</h1>
+//!   <p>
+//!     <strong>Sage advice for your coding conundrums!</strong>
+//!   </p>
+//!   <p float="left">
+//!     <img src="./assets/code1.png" width="29.5%"/>
+//!     <a href="https://adam-mcdaniel.net/sage"><img src="./assets/sage.png" width="68%"/></a>
+//!   </p>
+//! </div>
 //!
-//! ```text
-//!   █████   ██████    ███████  ██████   `-.        _.-'
-//!  ███░░   ░░░░░███  ███░░███ ███░░███   \ `,    .'/.'
-//! ░░█████   ███████ ░███ ░███░███████     \`.`. :.-'.-= .-'/
-//!  ░░░░███ ███░░███ ░███ ░███░███░░░       `-.:/o  .'-'/ .'
-//!  ██████ ░░████████░░███████░░██████         o\o / ._/.'
-//! ░░░░░░   ░░░░░░░░  ░░░░░███ ░░░░░░            \| /o|\`.
-//!                    ███ ░███                    |'o `.`.'.
-//!                   ░░██████                           `--'
-//!                    ░░░░░░            
-//! ```
-//!
-//! ![Logo](https://github.com/adam-mcdaniel/sage/blob/main/assets/sage.png)
+//! 🚧 🏗️ ⚠️ This language is under construction! ⚠️ 🏗️ 🚧
 //! 
 //! <embed type="text/html" src="web/index.html" title="Compiler" width="100%" height="940em"></embed>
 //! ***(The sage compiler itself can be compiled to web assembly to be executed on the web. This allows a sage compiler + interpreter to be hosted on a static web page and run embedded sage scripts. This web implementation compiles sage LIR code into sage virtual machine code, and then feeds it to a builtin virtual machine interpreter. The compiler can also switch to various backends, such as the C source code generator, or assembly output.)***
diff --git a/src/lib.rs b/src/lib.rs
index 5bd2de0f..5bfa5b77 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,20 +1,17 @@
 //! # The Sage Programming Language
 //!
-//! 🚧 🏗️ ⚠️ This language is under construction! ⚠️ 🏗️ 🚧
+//! 
+//!

🌿🌱sage🪴🍃

+//!

+//! Sage advice for your coding conundrums! +//!

+//!

+//! +//! +//!

+//!
//! -//! ```text -//! █████ ██████ ███████ ██████ `-. _.-' -//! ███░░ ░░░░░███ ███░░███ ███░░███ \ `, .'/.' -//! ░░█████ ███████ ░███ ░███░███████ \`.`. :.-'.-= .-'/ -//! ░░░░███ ███░░███ ░███ ░███░███░░░ `-.:/o .'-'/ .' -//! ██████ ░░████████░░███████░░██████ o\o / ._/.' -//! ░░░░░░ ░░░░░░░░ ░░░░░███ ░░░░░░ \| /o|\`. -//! ███ ░███ |'o `.`.'. -//! ░░██████ `--' -//! ░░░░░░ -//! ``` -//! -//! ![Logo](https://github.com/adam-mcdaniel/sage/blob/main/assets/sage.png) +//! 🚧 🏗️ ⚠️ This language is under construction! ⚠️ 🏗️ 🚧 //! //! //! ***(The sage compiler itself can be compiled to web assembly to be executed on the web. This allows a sage compiler + interpreter to be hosted on a static web page and run embedded sage scripts. This web implementation compiles sage LIR code into sage virtual machine code, and then feeds it to a builtin virtual machine interpreter. The compiler can also switch to various backends, such as the C source code generator, or assembly output.)***