novara754 / clara-lang

A toy programming language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clara

Clara is an upcoming systems programming language. The compiler generates native code through an LLVM backend.

See the examples folder to see the language in action.

Use the following commands to compile an example:

$ cargo install --path .
$ clara ./path/to/example

The compiler will generate an object file and place it in the ./build directory. Afterwards in can be linked (such as with GCC) to produce an executable:

$ gcc -no-pie ./build/the_object.o ./lib/clara.c
$ ./a.out

Note: Cargo, Rust and LLVM 13 are required to compile the Clara compiler.

Features

The language is still under heavily development and its future is yet unclear. That being said, the following features have already been implemented:

  • Functions
    • Extern functions
  • Structs
    • Transparent structs
    • Opaque structs
    • Struct literals
    • Struct field access
  • Pointers
    • Pointer types
    • Creating pointer values
    • Dereferencing pointer values
  • Values
    • Strings
    • Integers
    • Bools
    • Arrays
  • Control flow
    • If-else statements
    • While loops
    • For loops
  • FFI
    • Using C functions as extern functions
    • Using opaque C structs
    • Using transparent C structs
  • ...

License

Licensed under the MIT License.

About

A toy programming language.

License:MIT License


Languages

Language:Rust 95.6%Language:TypeScript 3.5%Language:Shell 0.8%Language:C 0.1%