Ampliphi
Ampliphi is a high-level, imperative programming language designed to compile down to the Varphi architecture.
Ampliphi was originally developed by Hassan El-Sheikha, Kevin Thevara, and Youssef Abouzied as part of a compilers course at the University of Toronto. It provides a familiar C-like syntax with strong static typing, arrays, and procedures. It attempts to abstract away the complexities of writing raw Varphi assembly while utilizing an advanced compiler optimization pipeline to produce more efficient Varphi code.
Quick Look
Ampliphi programs consist of global variable declarations followed by procedures. The entry point of every program is the main procedure.
Because Ampliphi compiles directly to Varphi, each declared variable maps directly to a tape in the generated Varphi code. When running your program via the Ampliphi CLI, you will be automatically prompted to initialize the values of these variables/tapes before the program executes.
Here is a simple program that calculates the sum of an array:
// Global declarations
int[5] arr;
int sum;
int i;
bool cond;
// Entry point
procedure main {
sum = 0;
i = 0;
// Note: Control flow conditions must be evaluated into a boolean variable first!
cond = i < 5;
while (cond) {
sum = sum + arr[i];
i = i + 1;
// Re-evaluate condition for the next iteration
cond = i < 5;
}
}Getting Started
Installation
You can install the Ampliphi toolchain directly via PyPI using uv or pip:
Alternatively, you can download the standalone executable for your operating system (Windows, macOS, or Linux) from our GitHub Releases.
Usage
To compile and run an Ampliphi source file, simply use the CLI:
If you use the --run flag, the CLI will interactively ask you to provide initial values for your global variables (tapes) before executing the compiled Varphi.
You can also inspect the compilation pipeline by emitting the AST, IR, or Tokens:
Language Guide
Variables and Types
All variables in Ampliphi are global and must be declared at the top of the file before any procedures. Ampliphi supports two primitive types: int and bool, as well as fixed-size arrays.
Out-of-bounds array access in Ampliphi is entirely memory-safe. If an index exceeds the bounds of an array, the compiler automatically clamps the access to the last valid element of that array. This prevents tape corruption and avoids runtime crashes.
Procedures
Code is organized into procedures. A program must contain at least one procedure named main. Procedures take exactly zero parameters and do not return values. All data must be passed between procedures by mutating global variables. Procedures can invoke only previously defined procedures using the invoke keyword.
Control Flow
Ampliphi supports if/else and while statements.
Formal Grammar
Ampliphi follows a strict, easy-to-parse grammar. Below is the formal EBNF specification:
Last updated
Was this helpful?

