Skip to content

occultlang/occult

Repository files navigation

The Occult Language

An enigmatic programming language.

occultang.org

About

Occult aims to be a memory-safe, statically typed programming language with an elegant syntax similar to Rust and the performance of C. It achieves this by cross-compiling Occult code into C and using tinycc as both a just-in-time (JIT) and ahead-of-time (AOT) compiler.

In Occult, dynamic arrays are the default array type, functioning similarly to vectors. These arrays are managed by tgc, a lightweight garbage collector implemented in C. Occult enforces the use of stack-based variables, promoting predictable memory management and reducing the risk of dangling pointers. However, it also allows for heap allocations using tgc's malloc implementation, which the garbage collector automatically frees.

Building

Assuming you have git gcc, and other required dependencies installed, all of this should go smoothly.

Warning

Occult uses tgc which causes undefined behavior but most of the time it should be fine, as per tgc's documentation.

Building on Linux (64-bit)

  1. Run build.sh

Building on Windows

Important

Even if you have gcc installed, you must follow this for now!

  1. Run install_gcc.bat
  2. Run build_windows.bat

Using Occult

Tip

If you need help use the -h option!

./occultc <source.occ>

To-do

Note

What am I working on? Fixing bugs and long-term things!

Long-term

  • Windows support
  • OSX Support
  • Bootstrapping
  • Move away from cross-compilation for just-in-time
  • Memory safety as far as we can get it
  • Full static analyzer
  • Fixing bugs
  • Better multidimensional array syntax
  • Add string-supported function calls + other types (array, etc.)
  • Module system

v1.2.0-alpha

Working on long-term things for now and flattening bugs!

Temporary

  • Add a "compilerbreakpoint" keyword (stops codegen / program during compilation)