Skip to content

Myra is a minimal systems programming language inspired by Oberon that compiles to C++23. Write clean, readable code with seamless access to the entire C/C++ ecosystem.

License

Notifications You must be signed in to change notification settings

tinyBigGAMES/Myra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Myra

Chat on Discord Follow on Bluesky

A minimal systems programming language that compiles to native executables via C++23.

Quick StartDocumentationExamplesFAQ

What is Myra?

Inspired by Niklaus Wirth's Oberon—itself derived from Pascal—Myra preserves Pascal's readability and structure while removing decades of accumulated complexity. The result: 45 keywords, 9 built-in types, seamless C++ interoperability, and code that compiles to native executables.

module exe HelloWorld;

import Console;

begin
  Console.PrintLn('Hello from Myra!');
end.

Key Features

  • Minimal by design — 45 keywords, 9 types. No redundancy.
  • C++ interoperability — Mix Myra and C++ freely. No wrappers needed.
  • Batteries included — Zig compiler, LLDB debugger, raylib, all bundled.
  • Integrated debugger — Source-level debugging with breakpoints and stepping.
  • Type extension — Record inheritance without class complexity.
  • Methods — Bind routines to types with explicit Self parameter.
  • Exception handling — Built-in try/except/finally.
  • Dynamic arrays — SetLength/Len with automatic memory management.
  • Unit testing — Built-in TEST blocks for integrated testing.

Quick Start

Prerequisites

  • Windows (64-bit)

Installation

  1. Download the latest release from the Releases page
  2. Extract to a folder (e.g., C:\myra)
  3. Add the bin folder to your PATH

That's it! Everything is bundled — Zig compiler, LLDB debugger, raylib, and the standard library.

Verify installation:

myra version

Create Your First Project

myra init HelloWorld
cd HelloWorld
myra build
myra run

Output:

Hello from Myra!

Language Overview

Built-in Types

Type Description
BOOLEAN True or false
CHAR Signed single byte character
UCHAR Unsigned single byte character
INTEGER 64-bit signed integer
UINTEGER 64-bit unsigned integer
FLOAT 64-bit floating point
STRING Auto-managed string
SET Bit set for ordinal ranges
POINTER Untyped pointer

Records and Methods

type
  TCounter = record
    Value: INTEGER;
  end;

method Increment(var Self: TCounter);
begin
  Self.Value := Self.Value + 1;
end;

method GetValue(var Self: TCounter): INTEGER;
begin
  return Self.Value;
end;

var
  Counter: TCounter;
begin
  Counter.Value := 0;
  Counter.Increment();
  Console.PrintLn('Count: {}', Counter.GetValue());
end.

Type Extension

type
  TShape = record
    X: INTEGER;
    Y: INTEGER;
  end;

  TCircle = record(TShape)
    Radius: INTEGER;
  end;

var
  Circle: TCircle;
begin
  Circle.X := 100;      // inherited from TShape
  Circle.Y := 100;      // inherited from TShape
  Circle.Radius := 50;  // own field
end.

C++ Integration

Myra's defining feature: seamless C++ integration. If it's not Myra syntax, it's C++.

module exe CppDemo;

import Console;

#include_header '<cmath>'

#startcpp header
inline int Square(int x) {
    return x * x;
}
#endcpp

begin
  Console.PrintLn('Square(7) = {}', Square(7));
  Console.PrintLn('sqrt(16) = {}', std::sqrt(16.0));
end.

Exception Handling

try
  DoRiskyOperation();
except
  Console.PrintLn('Error: {}', System.GetExceptionMessage());
finally
  Cleanup();
end;

Unit Testing

#unittestmode ON

module exe Tests;

import UnitTest;

routine Add(const A: INTEGER; const B: INTEGER): INTEGER;
begin
  return A + B;
end;

begin
end.

test 'Add returns correct sum';
begin
  TestAssertEqual(5, Add(2, 3));
end;

Module Types

Type Description
module exe Name Executable program
module lib Name Static library
module dll Name Dynamic/shared library

Documentation

Document Description
Quick Start Get running in 5 minutes
Tutorial Guided learning path
Language Reference Complete specification
Standard Library Console, System, Assertions, UnitTest
C++ Interop Mixing Myra and C++ code
Build System Compilation, targets, optimization
Examples Real-world code samples
FAQ Common questions answered
Migration Guide Coming from Pascal/Delphi
Contributing How to contribute

What's Included

Everything you need is bundled in the release:

myra/
├── bin/
│   ├── myra.exe              # Myra compiler CLI
│   └── res/
│       ├── libs/
│       │   ├── std/          # Standard library
│       │   │   ├── Console.myra
│       │   │   ├── System.myra
│       │   │   ├── Assertions.myra
│       │   │   └── UnitTest.myra
│       │   └── raylib/       # Raylib (static library)
│       │       ├── include/
│       │       └── lib/
│       ├── lldb/             # LLDB debugger with DAP support
│       │   └── bin/
│       │       ├── lldb-dap.exe
│       │       └── lldb.exe
│       ├── runtime/          # C++ runtime support
│       ├── zig/              # Bundled Zig compiler
│       │   └── zig.exe
│       └── tests/            # Test suite
├── src/                      # Compiler source (Delphi)
└── docs/                     # Documentation

CLI Commands

myra init <n>              # Create new project
myra init <n> -t lib       # Create static library project
myra init <n> -t dll       # Create dynamic library project
myra build                 # Compile and build
myra run                   # Run the executable
myra debug                 # Run with integrated debugger
myra clean                 # Remove generated files
myra zig <args>            # Pass arguments to Zig
myra version               # Show version
myra help                  # Show help

Integrated Debugger

Myra includes a fully integrated source-level debugger:

myra debug
Command Description
b <file>:<line> Set breakpoint
bl List breakpoints
c Continue
n Step over
s Step into
finish Step out
bt Backtrace
locals Show local variables
p <expr> Evaluate expression
r Restart program
quit Exit debugger

Use #breakpoint directives in code for automatic breakpoints.

Build Directives

#optimization DEBUG        // Debug build
#optimization RELEASEFAST  // Maximum performance
#target x86_64-windows     // Cross-compile target
#apptype GUI               // Windows GUI application
#include_header '<vector>' // Include C++ header
#link 'sqlite3'            // Link library
#breakpoint                // Set debugger breakpoint

Philosophy

Myra follows a simple principle:

If it's not Myra, it's C++. Emit it.

This means you can freely mix Myra and C++ code. No wrappers, no bindings, no FFI complexity. Write readable Myra for your application logic, drop to C++ when you need it.

Requirements

  • Platform: Windows (64-bit)
  • Dependencies: None! Everything is bundled in the release:
    • Zig compiler (C++ backend)
    • LLDB debugger (with DAP support for IDE integration)
    • Raylib (static library for game development)
    • Standard library (Console, System, Assertions, UnitTest)

License

Myra is licensed under the Apache License 2.0. See LICENSE for details.

Links


Myra™ — Pascal. Refined.

Copyright © 2025-present tinyBigGAMES™ LLC.
All Rights Reserved.

About

Myra is a minimal systems programming language inspired by Oberon that compiles to C++23. Write clean, readable code with seamless access to the entire C/C++ ecosystem.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project