A next-generation Pythonic language for building bare-metal Operating Systems.
Project description
OS-Lang: A Next-Generation Language for Bare-Metal Development
OS-Lang (.os) is a brand new, highly-opinionated programming language specifically designed for writing bare-metal operating systems, kernels, and low-level system software. It combines the clean, fast, indentation-based syntax of Python with the raw, bare-metal memory control of C and Rust.
If you are tired of setting up complex C++ makefiles or fighting the Rust borrow checker just to write a simple VGA text-mode driver or memory allocator, OS-Lang is for you.
Why OS-Lang?
When building an operating system, a language must compile directly to bare-metal machine code, manage raw memory addresses manually, and interface with hardware without relying on an underlying OS or garbage collector. OS-Lang achieves this seamlessly by compiling directly to LLVM IR.
- Pythonic Syntax: No semicolons, no curly braces, strict indentation.
- Bare-Metal Compilation: Compiles directly to object files (
.o) via LLVM. - No Runtime/Garbage Collector: You have 100% control over memory.
- Hardware Maps (
hwmap): A powerful paradigm for mapping C-style structs directly to volatile hardware memory registers. - Intrinsic OS Support: First-class support for
volatile_load,volatile_store, and CPU intrinsics. - Explicit Safety (
@unsafe): Hardware manipulation is strictly guarded by explicit unsafe scopes.
Installation
OS-Lang is available on the global Python Package Index (PyPI). You can install it instantly:
pip install os-lang
Quick Start
Create a new file called kernel.os:
# kernel.os
@unsafe
hwmap VgaChar:
ascii_char: u8
color_code: u8
@unsafe
fn _start() -> void:
let vga_buffer: *VgaChar = 0xB8000
let text: u8 = 79 # 'O'
let color: u8 = 15 # White text, black background
# Direct volatile memory manipulation to print to the screen
volatile_store(vga_buffer, 0, VgaChar(text, color))
while true:
pass
Compile it using the CLI:
osc kernel.os
Or, use the Desktop GUI App:
osc-gui
This will instantly generate kernel.ll (LLVM IR) and kernel.o (Machine Code), ready to be linked with a bootloader like GRUB!
Documentation
See the docs/ directory for full documentation:
- Language Reference: Syntax, Types, and Primitives.
- OS Core Definitions: Standard structures for Task State and Interrupt Frames.
The Playground
You can run the web-based interactive compiler playground locally:
pip install -r requirements.txt
python playground/app.py
Then visit http://localhost:5000 to write and compile OS code right in your browser!
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file os_lang-0.1.1.tar.gz.
File metadata
- Download URL: os_lang-0.1.1.tar.gz
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
777e8b73885400c0f4e7bc171f8e3efcd7043572b7e8cc55e8375aa4808fb943
|
|
| MD5 |
7f21197307e3dd34955956a4feeb5205
|
|
| BLAKE2b-256 |
0f889506f9e7e351ee1e19766b01a106fd12050c910130da797d36006fc6ffd9
|
File details
Details for the file os_lang-0.1.1-py3-none-any.whl.
File metadata
- Download URL: os_lang-0.1.1-py3-none-any.whl
- Upload date:
- Size: 28.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2b300f2430139788fa980395d6d6a1785344d582281923449bd019e86bebaa4
|
|
| MD5 |
cefd57afeaffb1895d956b5e3a2981be
|
|
| BLAKE2b-256 |
3007b0cb863e9a0d802c2542a31a2b735161e5ba835c75046ac46f077a7e6cfb
|