mysz-core 0.3.1

The main compiler for the Mysz language project
docs.rs failed to build mysz-core-0.3.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: mysz-core-0.3.2

Mysz Icon

mysz-core

A mouse-loving, mouse-based, mouse-enthusiastic programming language project.

This is the core repository, which holds the rust source code for the Lexer, Parser, Semantic analyser, Intermediate Code Generator, Utils for core, and assembly code generator of Mysz.

Support

OS architecture Supported (cranelift) Supported (llvm)
Linux (generic) x86_64 Supported Supported
Windows msvc x86_64 Planned Supported
MacOs ARM_64 Unsupported Supported

Embedding the Core Engine

mysz-core is designed as a standalone library crate that can be driven by external CLI tools or environments. Add it to your project's Cargo.toml:

[dependencies]
mysz-core = { git = "https://github.com/mysz-lang/mysz-core.git", branch = "main" }

Using crates.io

mysz-core is now on crates.io, making adding it to your project's Cargo.toml is easy:

[dependencies]
mysz-core = "0.3.1"

mysz-core will output object files, it is the responsibility of the embedding environment, or developer to link it and output a binary or library.

Basic Compilation Example

use mysz_core::compile_source;

fn main() {
    let source = "extern fn print_int(a: int); fn main() { var x = 60; print_int(x); };";
    
    match compile_source(source, "output.o") {
        Ok(()) => println!("Successfully compiled to output.o"),
        Err(e) => eprintln!("Compiler Error:\n{}", e),
    }
}

About String concatenation

The + operator can be used to concatenate strings:

"Hello, " + "world!"

To enable string concatenation, the host application or runtime must provide a function named str_concat that returns the concatenated string.

Whenever the compiler encounters a string concatenation expression, it generates a call to str_concat. It is the responsibility of the embedding environment or standard library to provide an implementation of this function.