Sign inSign up

javanhut/oxigen

By javanhut

•Updated 3 days ago

OxigenLang: a scripting language in Rust with a bytecode VM and JIT. https://www.oxigenlang.org

Image
Languages & frameworks
Developer tools
0

584

javanhut/oxigen repository overview

⁠OxigenLang

The official image for OxigenLang⁠, a scripting and programming language written in Rust. It runs on a bytecode VM with a Cranelift JIT, and comes with a standard library, a test runner, a formatter and a REPL.

⁠Tags

TagPoints to
latestThe newest release
0.2.1, v0.2.1A specific release (every release gets both forms)

Images are built for linux/amd64 and linux/arm64. Each one contains the same static binary that's attached to the GitHub release, on Alpine 3.21, with the standard library at /usr/local/lib/oxigen/stdlib.

⁠Running a script

Mount your code at /work, the working directory:

docker run --rm -v "$PWD:/work" javanhut/oxigen hello.oxi

Arguments after the file go to the script:

docker run --rm -v "$PWD:/work" javanhut/oxigen tool.oxi Alice --flag=value

Options for oxigen itself must come before the file:

docker run --rm -v "$PWD:/work" javanhut/oxigen --no-jit bench.oxi

⁠REPL

docker run -it --rm --entrypoint oxigen javanhut/oxigen

Overriding the entrypoint clears the default --help argument, so oxigen starts with no arguments and opens the REPL.

⁠Tests, formatting and checks

docker run --rm -v "$PWD:/work" javanhut/oxigen test             # run every *_test.oxi suite
docker run --rm -v "$PWD:/work" javanhut/oxigen check main.oxi   # report syntax errors as JSON
docker run --rm -v "$PWD:/work" javanhut/oxigen explain E0001    # explain an error code

oxigen test exits non-zero when a test fails, so it works as a CI step.

The container runs as an unprivileged user (oxigen, UID 10001). Commands that write to the mounted directory, such as fmt, need to run as your own user:

docker run --rm -v "$PWD:/work" --user "$(id -u):$(id -g)" javanhut/oxigen fmt .

⁠Using it as a base image

FROM javanhut/oxigen:0.2.1
COPY --chown=oxigen . /work
CMD ["main.oxi"]

The entrypoint is oxigen, so CMD only needs the script and its arguments.

⁠A short example

introduce strings

struct Person {
    name <str>
    age <int>
}

Person includes {
    fun greet() { "Hello, {self.name}" }
}

pattern is_even(n) when n % 2 == 0

main {
    p := Person("Alice", 30)
    println(p.greet())

    each i in range(4) {
        choose i {
            is_even -> println("{i} is even"),
            else -> println("{i} is odd")
        }
    }

    println(strings.upper("hello oxigen"))
}

The language guide⁠ covers the rest, including enums, the error model, modules, HTTP servers and C interop.

⁠Other ways to install

On Linux or macOS, without Docker:

curl -fsSL https://www.oxigenlang.org/install.sh | sh

Archives and checksums are on the download page⁠.

⁠License

Dual-licensed under MIT and Apache 2.0. Created by Javan Hutchinson.

Tag summary

Content type

Image

Digest

sha256:57a1e8b40…

Size

7.8 MB

Last updated

3 days ago

docker pull javanhut/oxigen