/ocen

Statically typed programming language

Primary LanguageC

ocen

ocen aims to provide you the same level of control over your code as C, but with some modern features like type inference, namespaces, stricter types and a module system. It transpiles to C, and can easily bind to C libraries.

Usage

Use the following command to build the initial compiler:

$ ./meta/bootstrap.sh       # Generates ./bootstrap/ocen if successful

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:

  • tests: Unit tests for the compiler
  • std: The standard library (implementations + C bindings)
  • examples: Various examples of the language
  • compiler: The compiler itself!