Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/boblio-max/origin/llms.txt

Use this file to discover all available pages before exploring further.

Origin is a Python-backed programming language designed for developers and AI systems that need expressive, readable code without sacrificing hardware-level control. With mandatory type annotations, a natural English-like syntax, and built-in commands for Raspberry Pi GPIO and PCA9685 servo control, Origin bridges the gap between high-level readability and low-level hardware precision. Scripts use the .or extension and run on any Python 3 environment — with full hardware features unlocked on Raspberry Pi.

Key features

Strict Typing

Every variable declaration requires a type annotation (let x: int = 10). This enforces predictable state across your program and makes Origin naturally safe for AI-generated code.

Hardware Control

Native, parenthesis-free commands for Raspberry Pi GPIO pins and PCA9685 servos. Servo angles are automatically clamped to 0–180° to prevent physical damage.

Python Interop

Drop into raw Python at any point using py { } blocks. Origin compiles to Python under the hood, so any Python library is accessible without special wrappers.

Parallel Execution

The parallel block spawns threads automatically — either one per statement in the block, or a fixed number of worker threads via parallel(n).

Module System

Import modules with aliases (import math as m) or pull in specific names (from robotics import drive). Origin resolves .or library files and standard Python modules alike.

Binary Builder

Compile any .or script into a standalone, zero-dependency executable using origin build <file.or>. Powered by PyInstaller behind the scenes.

How Origin works

When you run origin <file.or>, your source code passes through a four-stage pipeline entirely implemented in Python:
  1. Lexer (lexer.py) — The source text is scanned line by line and converted into a flat list of typed Token objects. Whitespace and comments are discarded. All reserved keywords (let, const, for, parallel, set, py, and more) are identified at this stage.
  2. Parser (parser.py) — A deterministic recursive-descent parser consumes the token list and builds an Abstract Syntax Tree (AST) made of typed node classes such as AssignNode, ForNode, SetNode, and ParallelNode.
  3. Interpreter / Code Generator (interpreter.py) — The Interpreter class walks the AST and emits equivalent Python source code as a string. Type annotations are checked at this stage; mismatches raise a TypeError before any code runs.
  4. Execution — The generated Python string is handed to Python’s built-in exec() with a controlled globals dict that pre-loads math, random, and the hardware runtime helpers (_execute_set_pin, _execute_i2c_read, _execute_i2c_write).
hello.or  →  Lexer  →  Token list  →  Parser  →  AST  →  Interpreter  →  Python string  →  exec()
No intermediate files are written during normal execution. The origin build command follows the same pipeline but saves the generated Python to disk and feeds it to PyInstaller to produce a standalone binary.

A first look at Origin syntax

The example below shows typed variable declarations, a list, a for loop, and print — the building blocks you will use in almost every Origin script.
# Typed variable declarations
let name: str  = "Origin"
let version: float = 1.7
let active: bool = true
const max_steps: int = 100

# A list of hardware targets
let pins: list = [4, 17, 27]

# Iterate with a for loop
for pin in pins {
    print pin
}

# Inline arithmetic and string output
let message: str = "Running version "
print message + str(version)
v1.7.5 is the current stable release of Origin. All syntax and behaviour documented on this site refers to this version.

Build docs developers (and LLMs) love