JSPM

brainrotscript

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q16437F
  • License MIT

🧠 A brainrot programming language that compiles to JavaScript - because why write normal code when you can write code that's absolutely sending you? πŸ’€

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 install

Quick Start

  1. Write your brainrot code in a .brainrot file:
job_application greet(name) {
    vibe_check (name) {
        console.log("Hello, " + name + "! No cap! 🧒");
    } big_yikes {
        console.log("Hello, anonymous user!");
    }
}

greet("World");
  1. 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
  1. Or compile to JavaScript:
brainrot compile index.brainrot -o output.js

Keyword 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 --help

Examples

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

  1. Lexical Translation: The compiler reads your .brs file and replaces all brainrot keywords with their JavaScript equivalents using regex with word boundaries
  2. Compilation: The translated code is saved as a .js file
  3. Execution: Node.js runs the compiled JavaScript
  4. 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 keywords

File 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.md

Contributing

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