Skip to content
This repository was archived by the owner on Feb 11, 2026. It is now read-only.

neverRare/butter

Repository files navigation

Butter

Documents | Contributing Guidelines

A tasty language for building efficient software.

Note: Still work in progress and experimental. Contributions are welcome.

A small taste

-- reverses an array in place
reverse(mut arr) => {
    len = arr^.len;
    for i in [0 .< len // 2] {
        mut elem = &arr^[i];
        mut opposite = &arr^[len - i - 1];
        elem^, opposite^ <- >opposite^, >elem^;
    }
}

Goals

Butter is a personal and experimental language that seeks balance for these aspects:

Note: Being an experimental language, these are all subject to change

  • Concise: The language constructs should be simple and have a feel of scripting language.
  • Unambiguous: There should be little-to-no ambiguity syntax-wise nor semantic-wise.
  • High-level: Low-level concepts that are hard to understand should be abstracted.
  • Efficient: The added runtime code for compiled programs should be minimal both in size and runtime impact.
  • Safe: Detectable errors should be caught on compile-time.

I also to want to experiment with novel features deemed necessary for these goals such refinement types.

Road map

A road map for the Butter programming language, depicted in the form style a retro video game map. A single road snakes from right-to-left, with multiple stops, ending with a causeway leading to a castle in the middle of a lake. A flag is placed on the first stop. The project mascot (a cute yellow bear) is at the second stop and exclaims "Let's Go!". The stops on the road are: parser, Hindley-Milner with row polymorphism, IR, lifetime analysis, refinement types, and finally LLVM. An enormous dragon looms behind the castle.

More details

Planned features

Note: These are subject to change

Features to be implemented

  • Hindley-Milner type inference and checking
  • Structural typing with row polymorphism
  • Mix of ownership systems and automatic reference counting — variables with share are reference counted unless cloning it is cheaper. All other values are owned.
  • Reference types with "no shared mutable" rule
  • Mutability/Shareability polymorphism of references
  • Lifetime inference and analysis
  • Refinement types

Features to be implemented later on

  • Type annotation and type aliases
  • Traits or type classes
  • Module and visibility system
  • newtype for nominally typed record types
  • Shareable and interiorly mutable containers — this is an escape hatch for "no shared mutable" rule of reference types
  • Code generation heuristics — as an example, the compiler will try to infer if such array can be just a stack array or if it needs to be allocated on heap. Refinement type is used to check if such array exceeds certain capacity

About

A tasty language for building efficient software. Currently in hiatus

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors

Languages