Transpiler for the Orion language to Go, written in Go.
# Build the transpiler
go build -o orionc ./cmd/orion/main.go
# Transpile a .ori file
./orionc my_program.ori
# Transpile and run
./orionc -run my_program.ori
# View tokens and AST (debug)
./orionc -debug my_program.oristring name = "hermes";
integer age = 45;
bool is_male = true;
float pi = 3.14;
if is_male {
io::write("is male");
} or_if age > 30 {
io::write("older");
} or {
io::write("default");
}
string helloName (string name) {
::("hello, $name !"); // implicit return with interpolation
}
string hello = helloName("hermes");
writeScreen () {
io::write("hello, world");
}
writeScreen();
[string] names = ["hermes", "lucas"];
// Iteration
for index, value :: names {
io::write(value);
}
// Array methods
names:push("gusta");
names:pop();
names:first();
names:last();
names:remove(0);
names:removeValue("hermes");
string greeting = "hello, $name !";
io::write("hello, world");
io::write(variable);
orion/
├── cmd/orion/main.go # CLI
├── internal/
│ ├── lexer/
│ │ ├── token.go # Token definitions
│ │ └── lexer.go # Tokenizer
│ ├── parser/
│ │ └── parser.go # Parser (tokens → AST)
│ ├── ast/
│ │ └── ast.go # AST nodes
│ └── codegen/
│ └── codegen.go # Go code generator
├── example.ori # Orion example
└── go.mod
| Orion | Go |
|---|---|
string |
string |
integer |
int |
bool |
bool |
float |
float64 |
[T] |
[]T |
