Matcha is an experimental compiled programming language with a GC-managed runtime. The project is still early in development, but it already includes a real compiler, runtime, and CLI capable of producing native binaries from Matcha source code.
Snippet adapted from matcha-compiler/examples/learning-matcha.mt:
val numbers = [2, 3, 4, 5];
var sum = 0;
for number in numbers {
sum += number;
}
val label = match sum {
14 => "expected total",
else => "unexpected total",
};
printString(label);
item Point = structure {
x: int;
y: int;
item origin(): Point = .{
x = 0,
y = 0,
};
item invert(self: Point): unit = {
self.x *= -1;
self.y *= -1;
};
item movedBy(self: Point, other: Point): Point = .{
x = self.x + other.x,
y = self.y + other.y,
};
item length(self: Point): int = self.x * self.x + self.y * self.y;
item print(self: Point): unit = printString(
"Point { x = " + self.x.toString() + ", y = " + self.y.toString() + " } (length: " + self.length().toString() + ")"
);
};
val origin = Point.origin();
val offset: Point = .{ x = 3, y = 6 };
val other_point = origin.movedBy(offset);
other_point.invert();
other_point.print();
- Matcha goals explains why the language exists, what it optimizes for, and what it intentionally does not try to be.
- learning-matcha.mt is a runnable tour of the current language surface.
Warning
Matcha is early-stage software. The language, compiler, runtime, CLI, and tooling may all change significantly.
Install Matcha Language Support from the Visual Studio Marketplace for syntax highlighting and basic editor integration.
brew tap mario-nowak/tap
brew install mario-nowak/tap/matcha-langIf clang is not available yet, install Xcode Command Line Tools:
xcode-select --installgit clone https://github.com/mario-nowak/matcha.git
cd matcha/matcha-compiler
matcha run examples/learning-matcha.mtFor full setup, source builds, and compiler usage, see matcha-compiler/README.md.
Today, the compiler can already handle a meaningful core language, including:
valandvarint,boolean, andstring- arrays with indexing,
append, andlength - structures with fields, methods, and type functions
if,while,for,loop, andmatch- built-ins such as
printInt,printString,readFile,readLine, andgetArguments - LLVM IR emission and native binary generation
The documented compiler setup is currently macOS-first.
This repository is a monorepo with two main parts:
matcha-compiler/— the compiler, runtime, CLI, tests, and example programstooling/ide-extensions/vs-code-extension/— a VS Code extension with syntax highlighting and basic editor support
.
├── matcha-compiler/ # compiler, runtime, examples, tests
├── tooling/ide-extensions/
│ └── vs-code-extension/ # VS Code extension
└── assets/ # logos and project assets
matcha-compiler/README.md— compiler setup, commands, and development workflowmatcha-compiler/examples/learning-matcha.mt— guided tour of the currently implemented languagematcha-compiler/examples/aoc-2024-01.mt— Advent of Code-style parsing and array processingmatcha-compiler/examples/customer-import-audit.mt— a more domain-shaped example using structures andmatchtooling/ide-extensions/vs-code-extension/README.md— VS Code extension documentation
