Package Exports
- brainrotscript
- brainrotscript/src/compiler.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (brainrotscript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
π§ BrainrotScript
A brainrot programming language that compiles to JavaScript. Because why write normal code when you can write code that's absolutely sending you? π
What is BrainrotScript?
BrainrotScript (.brainrot) is a programming language that uses Gen Z/brainrot slang as keywords instead of traditional programming keywords. It compiles directly to JavaScript, so you get all the power of JS but with the rizz of brainrot terminology.
Installation
# Install globally from npm (coming soon!)
npm install -g brainrotscript
# Or install locally for development
npm installQuick Start
- Write your brainrot code in a
.brainrotfile:
job_application greet(name) {
vibe_check (name) {
console.log("Hello, " + name + "! No cap! π§’");
} big_yikes {
console.log("Hello, anonymous user!");
}
}
greet("World");- Run it directly:
# Method 1: Direct execution (if installed globally)
brainrot index.brainrot
# Method 2: Using the run command
brainrot run index.brainrot
# Method 3: Local development
node bin/brs-cli.js index.brainrot- Or compile to JavaScript:
brainrot compile index.brainrot -o output.jsKeyword Mappings πΊοΈ
| JavaScript | BrainrotScript | Example |
|---|---|---|
function |
job_application |
job_application greet() {} |
return |
its_giving |
its_giving result; |
const |
lock_in |
lock_in name = "Chad"; |
let |
whatever |
whatever count = 0; |
if |
vibe_check |
vibe_check (condition) {} |
else |
big_yikes |
big_yikes { console.log("nah"); } |
for |
flex |
flex (whatever i = 0; i < 10; i++) {} |
while |
goon |
goon (condition) {} |
class |
squad |
squad MyClass {} |
this |
me_fr |
me_fr.property = value; |
true |
wallahi |
lock_in isTrue = wallahi; |
false |
no_cap |
lock_in isFalse = no_cap; |
null |
ghost |
lock_in empty = ghost; |
try |
fuck_around |
fuck_around { /* code */ } |
catch |
caught_4k |
caught_4k (error) {} |
async |
brb |
brb job_application getData() {} |
await |
hold_up |
hold_up response; |
new |
spawn |
lock_in obj = spawn MyClass(); |
extends |
inherits_drip |
squad Child inherits_drip Parent |
View complete mapping in brainrot-map.json
CLI Commands
# Run a .brainrot file directly
brainrot <file.brainrot>
# Run with explicit run command
brainrot run <file.brainrot>
# Compile to JavaScript
brainrot compile <file.brainrot> [-o output.js]
# Show all available keywords
brainrot keywords
# Show help
brainrot --helpExamples
Basic Example (examples/hello.brainrot)
job_application main() {
lock_in message = "Hello from BrainrotScript!";
console.log(message);
vibe_check (wallahi) {
console.log("This condition is true - no cap! π§’");
}
flex (whatever i = 0; i < 3; i++) {
console.log(`Loop ${i + 1}: Still got the rizz! π₯`);
}
}
main();Advanced Example (examples/advanced.brainrot)
squad VibeManager {
job_application constructor(vibes) {
me_fr.vibes = vibes || 0;
}
brb job_application addVibes(amount) {
hold_up new Promise(resolve => {
me_fr.vibes += amount;
resolve(me_fr.vibes);
});
}
}
brb job_application main() {
fuck_around {
lock_in manager = spawn VibeManager(100);
hold_up manager.addVibes(200);
console.log("Total vibes:", manager.vibes);
} caught_4k (error) {
console.error("Something went wrong:", error);
}
}
main();How It Works
- Lexical Translation: The compiler reads your
.brsfile and replaces all brainrot keywords with their JavaScript equivalents using regex with word boundaries - Compilation: The translated code is saved as a
.jsfile - Execution: Node.js runs the compiled JavaScript
- Cleanup: Temporary files are automatically removed
Development
# Test with the hello world example
npm test
# Run a specific example
brainrot examples/advanced.brainrot
# Check available keywords
brainrot keywordsFile Structure
brainrotscript/
βββ src/
β βββ compiler.js # Core compiler logic
βββ bin/
β βββ brs-cli.js # CLI interface
βββ examples/
β βββ hello.brainrot # Basic example
β βββ advanced.brainrot # Advanced features
βββ brainrot-map.json # Keyword mappings
βββ package.json
βββ README.mdContributing
Want to add more brainrot keywords? Edit brainrot-map.json and the compiler will automatically use them!
License
MIT - Use this however you want, just don't blame us if your code reviews get spicy πΆοΈ
Built with π and excessive amounts of brainrot
"It's giving main character energy but make it programming" - BrainrotScript Users, probably