ocen-lang / ocen

Statically typed programming language
https://ocen-lang.github.io/autodoc/
81 stars 7 forks source link

ocen

ocen is intended for people who enjoy the do-it-yourself nature of C, and the level of control it gives you - but don't want to deal with the syntactical nuances of C. ocen fundamentally behaves and programs very much like C, but offers some quality-of-life features such as:

ocen transpiles to C, and the only dependency for this compiler is a C compiler on your system (gcc by default, but can be specified with CC environment variable). For now ocen is only tested/supported on linux and macOS, but contributions to help get this running on Windows are welcome if anyone is interested.

Usage

Use the following command to build the initial compiler:

$ ./meta/bootstrap.sh  # Generates initial compiler
$ ./bootstrap/ocen --help

Compiling other programs

If you wish to use ocen from elsewhere, you can set the OCEN_ROOT environment variable to point to the root directory of this project. This lets the compiler find the standard library and other files it needs to compile your program.

$ export OCEN_ROOT=/path/to/ocen
$ export PATH=$OCEN_ROOT/bootstrap:$PATH # Add the compiler to your PATH

You can then use the compiler as follows:

$ ocen file.oc                # generates ./out and ./out.c
$ ocen file.oc -o ./build/out # generates ./build/out and ./build/out.c
$ ocen file.oc -n -c ./temp.c # generates only ./temp.c

For tips on developing the compiler, see DEVELOPING.md.

Language

You can find various examples of the language in: