Microwave
- Microwave Programming Language (Revision 2.x)

Microwave is an esoteric programming language created by Philip Naveen in 2024. Originally conceived as a COW/Brainfuck-style joke language using "microwave sounds," it has since evolved into a small, typed, imperative, C-like language that compiles to C. This document describes the current 2.whatever revision, which supersedes all prior sound-based command specifications.
Introduction
This language is a result of two things: boredom and taking computer systems last semester in college. The idea of the language is to show you can technically program a computer only using microwave sounds such as humming and beeps. In Microwave, the code is written using a set of simple commands that correspond to common actions performed on a microwave oven, such as heating, setting timers, and checking the status. Though you can technically do anything since Microwave is almost complete, we for sure would not recommend programming anything meaningful in it.
Getting Started
Microwave programs are written in files with a `.mw` extension. Start writing Microwave code using your favorite text editor. You can write programs in the microwave language, and they can be either interpreted or compiled. These can be written across multiple platforms. Initially, this was done in Python but was found to be extremely slow. Therefore, it was switched into C++ fully, which is slightly strange, but the author remarked this was due to convenience rather than anything else.
Overview
Microwave source code (.mw files) is parsed into an abstract syntax tree (AST) consisting of functions, statements, and expressions. The compiler emits C code, with the compiler itself written using a C++ toolchain.
The language supports:
- Functions (declared via
mode) - Primitive types and arrays
- Expressions with standard operators
- Structured control flow (
while,for,if,timer,break,continue) - A
defroststatement for zeroing variables - Lambda expressions (anonymous blocks)
- A
beepintrinsic mapped toprintfduring code generation
While the esoteric flavor remains through keywords like mode, beep, defrost, and timer, the core language is intentionally closer to C for usability.
File Structure and Build Process
Source files use the .mw extension. To build and use the compiler:
make # Build the compiler ./microwave program.mw output.c # Compile Microwave source to C gcc output.c -o program # Compile the generated C code
Program Structure
All code is contained within functions declared using the mode keyword:
mode <return_type> <function_name>(<params>) {
// function body
}
Supported return types include int, float, string, bool, and void. Parameters can use these types as well, including array forms like int[].
Example:
mode int main() {
int x = 0;
while (x < 10) {
beep x; # prints x
x = x + 1;
}
return 0;
}
Type System
Microwave supports the following primitive types:
int– mapped to Cintfloat– mapped to Cfloatstring– mapped tochar*bool– mapped to Cintwith values 0 and 1voidauto– internal inference placeholder (emitted asintin codegen)
Arrays are denoted with the [] suffix:
int[] numbers; float[] samples;
Statements
Variable Declaration
int count = 5; string msg = "hello"; bool flag; float r = 3.14; int[] arr;
Assignment
Both simple and compound assignment operators are supported:
count = count + 1; count += 2; r *= 2;
Control Flow
While loop:
while (count < 10) {
beep count;
count = count + 1;
}
For loop:
for (int i = 0; i < 5; i = i + 1) {
beep i;
}
Timer loop:
The timer statement is syntactic sugar for a counted for-loop:
timer (5) {
beep "tick";
}
This internally expands to for (int __i = 0; __i < 5; ++__i) { ... }
If/Else:
if (count == 0) {
beep "zero";
} else {
beep "non-zero";
}
Special Statements
Defrost:
The defrost statement sets a variable to zero:
defrost count; # becomes: count = 0;
Flow Control:
break;continue;return <expr>;orreturn;
Lambda Expressions
Anonymous function literals can be defined using the lambda keyword:
lambda (a, b) {
return a + b;
}
Lambda expressions are currently parsed into LambdaExpr nodes, and code generation treats them as named placeholder instances (_lambda_N). Full closure and inline emission are not yet implemented.
Expressions
Microwave supports a comprehensive set of expression types:
Literals
- Numbers:
123,3.14 - Strings:
"hello world" - Booleans:
true,false
Operators
Unary: ++, --, !, ~, +, - (prefix and postfix)
Binary:
- Arithmetic:
+,-,*,/,% - Bitwise:
&,|,^,<<,>> - Logical:
&&,|| - Comparison:
==,!=,<,>,<=,>= - Assignment:
=,+=,-=,*=,/=,%=,&=,|=,^=,<<=,>>=
Function Calls and Array Access
foo(x, y, 10); arr[i]
Array Literals
{1, 2, 3, 4}
Input/Output
The beep intrinsic is mapped directly to C's printf:
beep "Hello"; beep x; beep "Result: ", x;
For string concatenation patterns like "prefix" + var, the codegen transforms this into a sprintf call using a temporary buffer.
Examples
Timer Loop
mode void demo() {
int i = 0;
timer (5) {
beep "Tick ", i;
i = i + 1;
}
}
Defrost
mode int main() {
int value = 42;
defrost value; # value becomes 0
beep "Value reset: ", value;
return 0;
}
Lambda (Partial Implementation)
mode int main() {
auto f = lambda (x, y) {
return x + y;
};
int a = 3;
int b = 4;
beep "Sum: ", a + b;
return 0;
}
Language Evolution
All prior "sound command" tokens (such as mmm, mMm, MMm, beeP) have been removed. The original memory-tape model and pointer movement semantics are no longer part of the language. Legacy examples relying on these features are obsolete.
Implementation
The language implementation consists of:
- Lexer/tokenizer
- Parser (defined in
parser.h/parser.cpp) - AST node types:
VarDeclStmt,WhileStmt,ForStmt,TimerStmt,IfStmt,DefrostStmt,ReturnStmt,BreakStmt,ContinueStmt,ExprStmt, and various expression nodes - C code generator with the following mappings:
beep→printfdefrost var;→var = 0;timer (expr)→ counted for-loop using__i- Boolean values → integers 0 and 1
- String concatenation special case using
temp_str[256]buffer
Computational Class
Microwave is Turing-complete.
See Also
External Resources
- GitHub [1]