mica-lang / mica

A simple, amicable, embeddable scripting language
MIT License
33 stars 3 forks source link

Mica

Language reference Rust API GitHub crates.io

A simple, human-friendly scripting language, developed one feature at a time. Its goals are:

# Hello, Mica!

struct Counter impl
    func new(start, increment) constructor = do
        @value = start
        @increment = increment
    end

    func value() = @value

    func increment() = do
        @value = @value + @increment
    end
end

let c = Counter.new(1, 1)
while c.value < 100 do
    print(c.value)
    if c.value.mod(2) == 0 do
        print("even!")
    end
    c.increment()
end

At its current stage, it can be embedded into existing programs, but bugs may arise and certain parts may be cumbersome to use. The performance is also not even close to where I'd like it to be. But I want you to try it out and share your thoughts!

Try it out

To compile Mica, use one of the following commands:

# To install the latest stable release:
$ cargo install mica-cli
# To compile the latest revision:
$ git clone https://github.com/mica-lang/mica
$ cd mica
$ cargo build -p mica-cli --release

Then you can try it out interactively, or run a file:

# To open the REPL:
$ mica
# To run a file:
$ mica filename.mi

Check out the language reference for a detailed look at the language!

Why?

The Rust ecosystem has plenty of existing scripting languages, but none of them quite cuts it for me.

There's also a number of unfinished crates with bindings for more niche scripting languages that are written in C, but, well, they're unfinished.

I wanted a language that would take performance seriously. Be designed with specific goals in mind. Sugary, but not quite sweet enough to give you instant diabetes. And handmade by myself.

Designing and implementing a programming language has been one of my arch nemeses for the past few years with varying levels of success, but I feel like finally, this is it. This time I'm gonna do it.