The Wizarding World Programming Language written in Rust
38
stars
62
commits
Rust
primary language
Sep 16, 2023
updated
Parody Programming Language based in Harry Potter (Wizarding World). Experience the magical world of coding like never before! It's a really useful to project to learn Rust and how programming languages are done.
Ever wished you could speak the magical language of wizards and witches? PotterScript is your enchanted gateway to code with the charm and mystery of the Wizarding World.
This project is a remarkable endeavor to understand the magical connection between human logic and machine interpretation. It's a journey filled with trials, failures, and the sweet taste of success that only comes from the relentless pursuit of something extraordinary.
Powered by Rust and its incredible features like godlike error handling and orgasmic memory safety, PotterScript provides a solid toolkit for creating an enchanting programming experience.
Ready to embark on this magical journey? Here you have a few options:
input.potter file, parses and evals the code.In PotterScript there are no such things as functions or args, but there are spells and targets. To cast a spell you have to use the wand character ~ followed by the spell name and the target expression.
You can only cast a spell on one target, and the spell will do something with the target. For example, the ~Revelio {target} spell will print the target expression (variable or raw value) to the console.
~Revelio "Hello World!"
Spells can also of course mutate the target, like ~Engorgio {target} that will increment the target value by one.
index = 0
~Engorgio index
~Revelio index # prints "1"
List of spells:
~Aguamenti (no target): Returns "💦"~AvadaKedabra (no target): Process exit (Rust's panic!())~Engorgio {number|string}: Increments target value by one if number or transforms target string to uppercase~Incendio {string}: Append "🔥" to target value string~Inmobolus {ms}: Sleeps for ms milliseconds. If running on the browser it will use setTimeout and if running on the terminal it will use std::thread::sleep~Lumos (no target): Flags the runtime to start printing values with white background and black text. It doesn't work in WASM (yet) because it's not possible to change the console colors.~Nox (no target): Flags the runtime to stop printing values with white background and black text~Obliviate {variable}: Deletes the variable from the runtime memory~OculusReparo (no target): Returns "👓"~Periculum (no target): Prints "🔥🔥🔥🔥🔥🔥🔥🔥🔥" to the console~Reducio {number|string}: Decrements target value by one if number or transforms target string to lowercase~PetrificusTotalus {variable}: Freezes the variable value, so it can't be mutated anymore (make it const-like)~Revelio {target}: Prints the target expression to the console~Serpensortia (no target): Returns "🐍"~WingardiumLeviosa {string}: Appends new line ("\n") to target stringGenerate HogwartsHouse values (is a type like String or Integer), using the Sorting Hat, just like:
house = 🎩✨ # or SortingHat
if house = Griffindor {
~Periculum
}
Model your loops after a Quidditch match and use a 'Snitch' condition to end them.
index = 0
quidditch {
snake = ~Serpensortia
~WingardiumLeviosa snake
~WingardiumLeviosa snake
snake = snake + " some string"
~Revelio snake
~Incendio snake
~Revelio snake
~Engorgio index
if index == 4 {
snitch # Break loop
}
}
Outputs:
🐍
some string
🐍
some string🔥
🐍
some string
🐍
some string🔥
🐍
some string
🐍
some string🔥
🐍
some string
🐍
PotterScript is open for contributions! Cast your magical spells and bring your creativity to life.
Disclaimer: This project is not affiliated with Warner Bros. Entertainment Inc. or J.K. Rowling in any way.
62 commits
Rust
53.2%
TypeScript
38.2%
CSS
5.0%
JavaScript
3.5%
The Wizarding World Programming Language written in Rust
38
stars
62
commits
Rust
primary language
Sep 16, 2023
updated
Parody Programming Language based in Harry Potter (Wizarding World). Experience the magical world of coding like never before! It's a really useful to project to learn Rust and how programming languages are done.
Ever wished you could speak the magical language of wizards and witches? PotterScript is your enchanted gateway to code with the charm and mystery of the Wizarding World.
This project is a remarkable endeavor to understand the magical connection between human logic and machine interpretation. It's a journey filled with trials, failures, and the sweet taste of success that only comes from the relentless pursuit of something extraordinary.
Powered by Rust and its incredible features like godlike error handling and orgasmic memory safety, PotterScript provides a solid toolkit for creating an enchanting programming experience.
Ready to embark on this magical journey? Here you have a few options:
input.potter file, parses and evals the code.In PotterScript there are no such things as functions or args, but there are spells and targets. To cast a spell you have to use the wand character ~ followed by the spell name and the target expression.
You can only cast a spell on one target, and the spell will do something with the target. For example, the ~Revelio {target} spell will print the target expression (variable or raw value) to the console.
~Revelio "Hello World!"
Spells can also of course mutate the target, like ~Engorgio {target} that will increment the target value by one.
index = 0
~Engorgio index
~Revelio index # prints "1"
List of spells:
~Aguamenti (no target): Returns "💦"~AvadaKedabra (no target): Process exit (Rust's panic!())~Engorgio {number|string}: Increments target value by one if number or transforms target string to uppercase~Incendio {string}: Append "🔥" to target value string~Inmobolus {ms}: Sleeps for ms milliseconds. If running on the browser it will use setTimeout and if running on the terminal it will use std::thread::sleep~Lumos (no target): Flags the runtime to start printing values with white background and black text. It doesn't work in WASM (yet) because it's not possible to change the console colors.~Nox (no target): Flags the runtime to stop printing values with white background and black text~Obliviate {variable}: Deletes the variable from the runtime memory~OculusReparo (no target): Returns "👓"~Periculum (no target): Prints "🔥🔥🔥🔥🔥🔥🔥🔥🔥" to the console~Reducio {number|string}: Decrements target value by one if number or transforms target string to lowercase~PetrificusTotalus {variable}: Freezes the variable value, so it can't be mutated anymore (make it const-like)~Revelio {target}: Prints the target expression to the console~Serpensortia (no target): Returns "🐍"~WingardiumLeviosa {string}: Appends new line ("\n") to target stringGenerate HogwartsHouse values (is a type like String or Integer), using the Sorting Hat, just like:
house = 🎩✨ # or SortingHat
if house = Griffindor {
~Periculum
}
Model your loops after a Quidditch match and use a 'Snitch' condition to end them.
index = 0
quidditch {
snake = ~Serpensortia
~WingardiumLeviosa snake
~WingardiumLeviosa snake
snake = snake + " some string"
~Revelio snake
~Incendio snake
~Revelio snake
~Engorgio index
if index == 4 {
snitch # Break loop
}
}
Outputs:
🐍
some string
🐍
some string🔥
🐍
some string
🐍
some string🔥
🐍
some string
🐍
some string🔥
🐍
some string
🐍
PotterScript is open for contributions! Cast your magical spells and bring your creativity to life.
Disclaimer: This project is not affiliated with Warner Bros. Entertainment Inc. or J.K. Rowling in any way.
62 commits
Rust
53.2%
TypeScript
38.2%
CSS
5.0%
JavaScript
3.5%