Corium is a modern, fast and simple scripting language,
empowering easy but powerful programming with high performance.
A language for everyone for everything.
The goal is to create a new programming language,
which is easy to learn for new developers and
for developers comming from other languages.
The language is also very flexible and fast
thus a good choise for many different projects.
- Simple
- Safe and test driven
- Statically typed with type inference
- Builtin parallelism using the
parallel
keyword - Builtin GPU computing using the
compute
keyword - Fast scripting and prototyping
- Cross-platform
- Workspace system for complex projects
- Simple but powerful types
- Builtin package manager
The project was started around February in 2021,
to create a new programming language for the world.
A language for beginners and experts, for desktop and mobile.
Trying to unite different tech-stacks.
This year (2021/2022) I will participate with Corium as my project in Jugend Forscht,
a German science competition.
I was always bugged by the two language problem:
If you write your code in a simple and high level language,
the productivity will be high but not the performance.
Of course the performance in enough in most cases,
but many performance critical parts are often implemented in a fast language such as C, C or Rust.
This is very error prone and requires much more effort from the development team.
There are existing approaches for a simple and fast programming language,
but they are all komplex languages themselves.
Corium aims to just be simple and fast,
using a clean and consistent syntax and a "friendly" compiler.
In my opinion, many languages are too bloated in features,
having multiple ways to do the same thing.
Corium is in an early development stage.
The compiler is currently prepared for an alpha release,
with basic but solid features.
The Alpha will be available in the next Months for testing and feedback purposes.
If you want to support the project,
feel free to contribute or suggest any idea you would like.
You can also support the project without development, by sponsoring!
Corium IntelliJ IDEA Plugin
Also works with CLion, WebStorm, Rider and any other IDEA based IDE.
Discord Server
Join our small and friendly community. Everyone is welcome!
The two primary components are:
A special thanks to all of my sponsors!
Thank you very much for supporting my work,
this gives me a lot of motivation.
Sponsors in chronological order:
- Jean Igrec https://github.com/Jigrec
- Andreas Partsch https://github.com/4ndre4s
- Kevin Sieg https://github.com/KevinSieg
"Talk is cheap. Show me the code." ― Linus Torvalds
Code snippets in Corium to get a quick overview.
- No semicolons - new line per statement
- Keywords are lowercase
- Mutable variables are lowerCamelCase
- Immutable variables are SCREAMING_CASE
- Types and classes are UpperCamelCase
- Functions and methods are lowerCamelCase
- Interfaces are IUpperCamelCase with an I as prefix
- Modules are lowercase
- Source file names are lowercase with the .cor file extension
There are 4 primitive data types in Corium.
Choosing a type is easy, each primitive type has exactly one purpose.
int
- A 64-bit signed integer.
- Can hold values from -9223372036854775808 to 9223372036854775807.
- Because it it signed, it can also hold negative values.
- This type is used as the default type for natural number calculations.
- The equivalent in other C style languages is long.
float
- 64-bit double precision float.
- Can hold values from -2.22507•10−308 to approximately 1.79769•10308.
- This type is used as the default type for real number calculations.
- The equivalent in other C style languages is double.
bool
- A boolean type.
- Can either be true (1) or false (0).
char
- A 32-bit unsigned UTF-32 encoded character.
- Can hold any unicode codepoint.
Corium contains multiple advanced data types and structures.
These are implemented in the standard library, but the most important ones are
auto-imported into each file.
String
List
Option
Result
BigInt
BigFloat
Object
# This is a single line comment
#! This
is
a multi line
comment
!#
#@ This is a doc-comment which will appear in the generated documentation.
The Corium hello world is a one-liner:
print("Hello, world")
The print() function is used to print text to the console.
A new line is appended by default.
In general, the identifier is written before the type.
For most cases, the type is inferenced from the expression:
Expression | Inferred type |
---|---|
10 | int |
0.5 | float |
true | bool |
'C' | char |
"Muffins" | String |
new MyClass() | MyClass |
Of course the type can be explicitly specified.
So
A:
let x = 10
is seen by the compiler as
B:
let x int = 10
In most cases, letting the compiler infer the types is the way to go. (A)
But sometimes, extra type information can be beneficial. (B)
Mutable variables are defined using the let
keyword.
They also use lowerCamelCase as naming convention.
let num = 10
let time = 23.45
let food = "Burger"
Immutable variables are defined using the const
keyword:
They also use SCREAMING_CASE as naming convention.
const IS_DEBUG = true
const PI = Math.atan2(1.0, 1.0) * 4.0
const FAVOURITE_FOOD = "Lasagne"
Functions are defined using the function
keyword.
A simple function without a parameter or return type:
function simple() {
}
A function with a float
x as parameter but no return type:
function simple(x float) {
}
A function with a float
x as parameter, return type of type float
and a return
statement:
function square(x float) float {
return x * x
}
A simple if
-statement:
let isSunshine = true
if isShunshine {
print("Let's go to the beach")
}
For chained conditions the and
, or
and not
operators are used.
An if
-statement with a chained condition:
let isSunshine = true
let isSummer = true
let temperate = 20
if isShunshine or isSummer and not temperature < 18 {
print("Let's go to the beach")
}
if
-statements can also be chained using else
and else if
A chained if
-statement with an else
block:
let isSunshine = true
if isShunshine {
print("Let's go to the beach")
} else {
print("It's raining, let's play some games instead")
}
A chained if
-statement with an else if
and else
block:
let isSunshine = true
let temperate = 20
if isShunshine {
print("Let's go to the beach")
} else if not temperate < 15 {
print("Let's go for a walk")
} else {
print("It's raining, let's play some games instead")
}
For long and complex comparisons,
the compare
statement can be used.
It resembles a switch-statement from C-like languages,
but is much more powerful.
let grade = 'C'
compare grade {
'A' => print("Easy"),
'B' => print("Very good!"),
'C' => print("It's okay"),
'D' => print("I'll do better next time"),
'E' or 'F' => print("Let's try that again"),
else => print("Grades must be from A to F!")
}