Compile Atomic Text - a lightweight, statically typed language inspired by C/C++ with simplified syntax, expressive function names, and minimal boilerplate. Built to compile using LLVM.
- Statically Typed: All variables must have a declared type.
- C/C++-style Declarations: Familiar syntax for variable and function declarations.
- LLVM-based: Compiles to LLVM IR for optimization and native code generation.
- Simplified Syntax: Aims to be simpler than C++ with some playful custom keywords.
// Primitive Types
int // Integer
float // Floating point
string // UTF-8 string
bool // Boolean
// Variable Declarations
int x = 5;
float pi = 3.14;
string name = "Ami";
bool is_cat = true;
// Function Definition
fn add(int a, int b) -> int {
return a + b;
}
// Main Function (Entry Point)
fn main() -> int {
print("Cat language running.\n");
return 0;
}
// Output
print("Hello, World!\n"); // Standard output (newline included)
// A special function for cat-like output.
meow("just a cat chilling\n");
// will output just a cat chilling
// Input
int age;
scan(age);
// Conditionals
if (x > 0) {
print("Positive\n");
} else {
print("Non-positive\n");
}
// Loops
while (x < 10) {
print(x);
x = x + 1;
}
// This is a single-line comment
The included run.bash script will build and run your Cat programs.
bash run.bashThis will:
- Build the
catcompiler. - Compile
test/main.catinto LLVM IR (output.ll). - Compile the LLVM IR into a native executable (
my_program). - Run the
my_programexecutable.
fn main() -> int {
int a = 5;
int b = 3;
int c = add(a, b);
print("Result: ");
print(c);
print("\n");
return 0;
}
fn add(int x, int y) -> int {
return x + y;
}