Primitive Types
Four integer types, from int8 to int64, with support for integer and character literals.
int8 a = 1;
int8 c = 'a';A programming language built from scratch in C, featuring typed variables, function calls, arithmetic expressions, and compilation to x86-64 assembly.
View RepositoryImplementation
CTarget Architecture
x86-64
Compilation
Assembly generation
The goal is to build a programming language from the ground up, from parsing source code to generating machine-oriented assembly. Rather than interpreting expressions directly, the compiler translates programs into x86-64 assembly.
The language currently focuses on typed integer values, arithmetic expressions, function declarations, function calls, and return values. The scope is intentionally small, keeping the focus on the fundamentals of compiler design and low-level execution.
Language Features
Four integer types, from int8 to int64, with support for integer and character literals.
int8 a = 1;
int8 c = 'a';Define functions with typed parameters and return types, pass arguments, and call other functions.
fn add2(int32 a, int32 b): int32 {
return a + b;
}Declare and update variables, perform arithmetic operations, call functions, and return computed values.
int32 result = add2(10, 20);
return result;Type System
Variables and function signatures use explicit integer types, making the size of each value part of the language syntax.
int8
8-bit
int16
16-bit
int32
32-bit
int64
64-bit
Both numeric and character literals can initialize variables.
int8 a = 1;
int8 c = 'a';Syntax
Functions declare their parameter types and return type. Statements end with semicolons, and the # character introduces comments.
# A function with two parameters
fn add2(int32 a, int32 b): int32 {
return a + b;
}
fn main(int32 x): int32 {
int8 c = 'a';
c = add2(c, 't');
return c;
}Language Reference
Functions declare typed parameters and a return type.
fn add(int32 a, int32 b): int32 { ... }Variables are declared with a type and an initial value.
int32 value = 42;Statements are terminated with a semicolon.
return value;Use # to write a comment.
# This is a commentCurrent Scope
The compiler currently targets x86-64 and supports functions with return values, typed parameters, function calls, integer variables, and arithmetic expressions. Functions with more than seven parameters are not currently supported.