Skip to content

caoimhebyrne/petal

Repository files navigation

petal 🌸

This is the compiler for my language, Petal. The plan for this compiler is for it to provide enough features to build a self-hosted compiler.

// This is the main function, it is called similar to how it would be called in C.
// Petal programs are linked with libc, meaning `main` is called from the `__start` 
// symbol.
//
// This function expects an `i32` to be returned.
func main() -> i32 {
    // This is a variable declaration. Since it is in a function block, it can only
    // be accessed from within this function block.
    i32 my_variable = 100;

    // Values can be returned either by referencing a variable name, or writing the value inline.
    return my_variable;
}

Building

  1. Clone this git repository.
  2. Build the compiler using cargo build

License

This project is licensed under the MIT license. See the LICENSE file for more information.

About

A language with a compiler written in Rust

Topics

Resources

License

Stars

Watchers

Forks

Languages