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

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Myra

Discord Reddit Facebook Follow on Bluesky

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

Quick Start β€’ Documentation β€’ Examples β€’ FAQ

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, Myra Edit, all bundled.
  • πŸ–₯️ Myra Edit β€” Full editor with syntax highlighting, IntelliSense, and debugging.
  • πŸ› 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, Myra Edit, raylib, and the standard library.

Verify installation:

myra version

Create Your First Project

myra init HelloWorld
cd HelloWorld

Option 1: Use Myra Edit (Recommended)

myra edit

This opens your project in a fully-configured editor with IntelliSense, debugging, and build integration.

Option 2: Command Line

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, Geometry, Strings, Convert, Files, Paths, Maths, DateTime
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
β”‚   β”œβ”€β”€ myralsp.exe           # Language Server (IntelliSense)
β”‚   └── res/
β”‚       β”œβ”€β”€ libs/
β”‚       β”‚   β”œβ”€β”€ std/          # Standard library
β”‚       β”‚   β”‚   β”œβ”€β”€ Assertions.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ Console.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ Convert.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ DateTime.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ Files.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ Geometry.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ Maths.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ Paths.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ Strings.myra
β”‚       β”‚   β”‚   β”œβ”€β”€ System.myra
β”‚       β”‚   β”‚   └── UnitTest.myra
β”‚       β”‚   └── raylib/       # Raylib (static library)
β”‚       β”‚       β”œβ”€β”€ include/
β”‚       β”‚       └── lib/
β”‚       β”œβ”€β”€ lldb/             # LLDB debugger with DAP support
β”‚       β”‚   └── bin/
β”‚       β”‚       β”œβ”€β”€ lldb-dap.exe
β”‚       β”‚       └── lldb.exe
β”‚       β”œβ”€β”€ edit/             # Myra Edit (portable VSCodium)
β”‚       β”‚   β”œβ”€β”€ data/
β”‚       β”‚   β”‚   └── extensions/
β”‚       β”‚   β”‚       └── tinybiggames.myra-1.0.0/
β”‚       β”‚   └── Edit.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 edit                  # Open project in Myra Edit
myra zig <args>            # Pass arguments to Zig
myra version               # Show version
myra help                  # Show help

πŸ–₯️ Myra Edit

Myra includes a complete editor based on VSCodium:

myra edit

This opens your project in a fully-configured editor with:

IntelliSense Features

  • Semantic Highlighting β€” Context-aware coloring for types, variables, parameters, fields, routines, and constants
  • Code Completion β€” Keywords, types, symbols, and record field access
  • Signature Help β€” Parameter hints with overload support (navigate with ↑/↓)
  • Hover Information β€” Symbol details on mouse hover
  • Go to Definition β€” Jump to symbol declarations (F12)
  • Go to Type Definition β€” Jump from variable to its type declaration
  • Go to Implementation β€” Navigate to implementation (Ctrl+F12)
  • Find All References β€” Find all usages of a symbol (Shift+F12)
  • Document Highlights β€” Highlight all occurrences of symbol under cursor
  • Rename Symbol β€” Rename across all files (F2)
  • Document Outline β€” Navigate symbols in the current file
  • Folding Ranges β€” Collapse/expand routines, records, and test blocks
  • Smart Selection β€” Expand selection to enclosing syntax (Shift+Alt+β†’)
  • Real-time Diagnostics β€” Errors and warnings as you type
  • Code Actions β€” Quick fixes and refactoring suggestions

Debugging

  • Breakpoints β€” Click in the gutter or press F9
  • Step Debugging β€” Step over (F10), step into (F11), step out (Shift+F11)
  • Variable Inspection β€” Watch expressions and local variables
  • Call Stack β€” Full backtrace navigation
  • Run/Debug Buttons β€” Quick access in the editor title bar

Editor Features

  • Syntax Highlighting β€” Full Myra grammar with C++ passthrough support
  • Code Snippets β€” Quick templates for common patterns
  • Build Integration β€” Ctrl+Shift+B to build
  • Keyboard Shortcuts β€” F5 (debug), Ctrl+F5 (run without debugging)

πŸ› 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)
    • Myra Edit (customized VSCodium with syntax highlighting, IntelliSense, and integrated debugging)
    • Raylib (static library for game development)
    • Standard library (Console, System, Assertions, UnitTest, Geometry, Strings, Convert, Files, Paths, Maths, DateTime)

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