Skip to content

HermesSantos/orion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orion logo

Orion → Go Transpiler

Transpiler for the Orion language to Go, written in Go.

Usage

# 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.ori

Orion syntax

Variables

string name = "hermes";
integer age = 45;
bool is_male = true;
float pi = 3.14;

Conditionals (if / or_if / or)

if is_male {
    io::write("is male");
} or_if age > 30 {
    io::write("older");
} or {
    io::write("default");
}

Functions with return values

string helloName (string name) {
    ::("hello, $name !");   // implicit return with interpolation
}
string hello = helloName("hermes");

Void functions

writeScreen () {
    io::write("hello, world");
}
writeScreen();

Arrays

[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 interpolation

string greeting = "hello, $name !";

I/O

io::write("hello, world");
io::write(variable);

Project structure

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

Type mapping

Orion Go
string string
integer int
bool bool
float float64
[T] []T

About

orion language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages