Skip to content

Blopaa/Orn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orn Lang

A modern low-level programming language with clear error messages and fast builds

Orn Lang Logo

Why?GoalsPerformanceGetting StartedUsage


Introduction

Orn is a strongly typed programming language designed for performance and clarity. Inspired by TypeScript's approach to bringing type safety to dynamic languages, Orn aims to make low-level programming more accessible with modern type annotations and clear syntax. Its primary goals are fast compilation, precise error feedback, and a clean, maintainable architecture.

The syntax is designed to be approachable for developers coming from high-level languages while providing direct control over low-level operations. The long-term vision is to evolve into a fully object-oriented language.


Why?

Many low-level languages have steep learning curves that intimidate developers from high-level backgrounds. Orn bridges this gap by offering:

  • Modern syntax – TypeScript-style type annotations with const and let
  • Clear error feedback – Error messages are precise and tell you exactly how to fix problems
  • Low-level control – Direct access to memory and performance-critical operations
  • Fast compile times – Efficient compilation pipeline for quick iteration
  • Strong type guarantees – Minimize runtime surprises with a robust type system
  • Gradual learning curve – Start with high-level concepts, dive into low-level details as needed

Language Goals

  • 🎯 Clear Error Feedback – Errors are actionable and easy to understand
  • ⚡ Fast Compilation – Quick iteration cycles for development
  • 🔒 Type Safety – Strong typing at the core
  • 🚀 Path to OOP – Current syntax is just the beginning
  • 🛠️ Simplicity First – Minimalism without sacrificing power

Performance Architecture

Orn uses a zero-copy reference design inspired by production compilers like Clang and Rust:

Source Buffer (one malloc)
    ↓
Tokens (ptr+len references)
    ↓
AST (ptr+len references)
    ↓
Semantic Analysis (ptr+len references)
    ↓
IR (Three-Address Code)
    ↓
IR Optimization (multiple passes)
    ↓
Machine code ( not started to develop yet )

Benefits:

  • Single source allocation, thousands fewer mallocs
  • No duplicate string storage throughout pipeline
  • Better memory locality and faster compilation
  • References become copies only in final assembly output

Traditional compilers duplicate every identifier dozens of times. Orn references the original buffer until code generation.


Getting Started

Prerequisites

You'll need:

  • GCC or Clang – C compiler
  • CMake (3.10+) – Build system
  • Git – Version control
  • Valgrind (optional) – Memory debugging

Installation

# Clone the repository
git clone https://github.com/Blopaa/Orn.git
cd Orn

# Build the project
mkdir build && cd build
cmake ..
cmake --build .

You can now run Orn on your own programs:

./orn program.orn

for help:

./orn --help

Usage

Example Program

const x: int = 42;
let rate: float = 3.14;
const msg: string = "Hello, World!";
const b: bool = true; // bools and ints cannot mix

if x > 0 {
   print(msg);
}

let i: int = 0;
while i <= 10 {
    print(i);
    i++;
}

// simple add function
fn add(a: int, b: int) -> int {
    return a + b;
}

print(add(3, 5));

Error Example

Orn provides actionable error messages:

error [E2005]: cannot assign to constant (x)
  --> source.orn:2:1
   |
 2 | x = 20;
   | ^
   |
   = help: assignment to immutable value
   = note: constants cannot be modified after initialization
   = suggestion: use a mutable variable instead

error [E1001]: mismatched types (x)
  --> source.orn:2:11
   |
 2 | const x: int = "hello";
   |                ^^^^^^^
   |
   = expected `int`, found `string`
   = note: string literals cannot be assigned to int variables
   = suggestion: change variable type or cast the value

Join Us

We welcome contributors and feedback!


Attribution

This README's structure and presentation were inspired by TheDevConnor / Luma.


Built with ❤️

About

A compiler for a typescript like, low level programming language

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •