Home

Awesome

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.

Installing

Automated Installation

For the "I don't care, just give me the command" people. This will add some environment variables to your shell config

# Default (installs in ~/ocen):
$ curl -sSL https://raw.githubusercontent.com/ocen-lang/ocen/master/meta/install.sh | bash

# Custom install path:
$ curl -sSL https://raw.githubusercontent.com/ocen-lang/ocen/master/meta/install.sh | BASE=~/local/ bash

Manual Installation

Clone the repository:

$ git clone https://github.com/ocen-lang/ocen.git
$ cd ocen

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

Usage

You also can find various examples of the language being used in: