Skip to content

Brainrotlang/brainrot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Brainrot Programming Language

license build

Brainrot is a meme-inspired programming language that translates common programming keywords into internet slang and meme references. It's built using Flex (lexical analyzer) and Bison (parser generator), making it a fun way to learn about language processing and compiler design.

🤔 What is Brainrot?

Brainrot is a C-like programming language where traditional keywords are replaced with popular internet slang. For example:

  • voidskibidi
  • intrizz
  • forflex
  • returnbussin

📋 Requirements

To build and run the Brainrot compiler, you'll need:

  • GCC (GNU Compiler Collection)
  • Flex (Fast Lexical Analyzer)
  • Bison (Parser Generator)

Installation on Different Platforms

Ubuntu/Debian

sudo apt-get update
sudo apt-get install gcc flex bison libfl-dev

Arch Linux

sudo pacman -S gcc flex bison

macOS (using Homebrew)

brew install gcc flex bison

Some macOS users are experiencing an error related to libfl. First, check if libfl is installed at:

/opt/homebrew/lib/libfl.dylib  # For Apple Silicon
/usr/local/lib/libfl.dylib  # For Intel Macs

And if not, you have to find it and symlink to it. Find it using:

find /opt/homebrew -name "libfl.*"  # For Apple Silicon
find /usr/local -name "libfl.*"  # For Intel Macs

And link it with:

sudo ln -s /path/to/libfl.dylib /opt/homebrew/lib/libfl.dylib  # For Apple Silicon
sudo ln -s /path/to/libfl.dylib /usr/local/lib/libfl.dylib  # For Intel Macs

🚀 Building the Compiler

  1. Clone this repository:
git clone https://github.com/araujo88/brainrot.git
cd brainrot
  1. Generate the parser and lexer:
bison -d -Wcounterexamples lang.y -o lang.tab.c
flex -o lang.lex.c lang.l
  1. Compile the compiler:
gcc -o brainrot lang.tab.c lex.yy.c ast.c -lfl

Alternatively, simply run:

make

💻 Usage

  1. Create a Brainrot source file (e.g., hello.brainrot):
skibidi main {
    yapping("Hello, World!");
    bussin 0;
}
  1. Run your Brainrot program:
./brainrot < hello.brainrot

📚 Language Reference

Keywords

Brainrot C Equivalent
skibidi void
rizz int
cap bool
cooked auto
flex for
bussin return
edging if
amogus else
goon while
bruh break
grind continue
chad float
gigachad double
yap char
grimace const
sigma rule case
based default
mewing do
gyatt enum
whopper extern
cringe goto
giga long
edgy register
soy short
nut signed
maxxing sizeof
salty static
gang struct
ohio switch
chungus union
nonut unsigned
schizo volatile

Builtin functions

  • yapping(string): equivalent to puts(const char *str)
  • baka(string): equivalent to fprintf(stderr, const char *format, ...)

Operators

The language supports basic arithmetic operators:

  • + Addition
  • - Subtraction
  • * Multiplication
  • / Division
  • = Assignment
  • < Less than
  • > Greater than
  • && Logical AND
  • || Logical OR

⚠️ Limitations

Current limitations include:

  • No support for increment/decrement operators (++/--)
  • Limited support for complex expressions
  • No support for functions other than main
  • Basic error reporting

🔌 VSCode Extension

Brainrot has a Visual Studio Code extension to enhance your development experience with syntax highlighting and support for the Brainrot programming language. You can find it here:

Brainrot VSCode Extension

🤝 Contributing

Feel free to contribute to this project by:

  1. Forking the repository
  2. Creating a new branch for your feature
  3. Submitting a pull request

📝 License

This project is licensed under the GPL License - see the LICENSE file for details.

🙏 Acknowledgments

  • This project is created for educational purposes
  • Inspired by meme culture and internet slang
  • Built using Flex and Bison tools

🐛 Known Issues

  1. Error reporting is minimal
  2. No support for arrays
  3. Limited string manipulation capabilities
  4. No support for complex control structures

Please report any additional issues in the GitHub Issues section.