Bruh@

From Esolang
Jump to navigation Jump to search

Bruh@ is a language created by User:Sanya. It's Brainfuck derivative.

Bruh@
Designed by User:Sanya
Appeared in 2023
Memory system cell-based
Computational class Turing-complete
Reference implementation Unimplemented
Influenced by Brainfuck
File extension(s) .bh@

Commands

In the Bruh@ there're 11 commands. They are separating by '@'.

Brainfuck Bruh@ Description
< bRuh Move to the left cell
> Bruh Move to the right cell
+ BRuh Increment current memory block value by 1.
- brUH Decrement current memory block value by 1.
. bRUH Print current cell value as an ASCII char.
, BRUh Read charachter and write its ASCII-code into current cell.
[ BruH Start loop
] BrUh Go to BruH if current cell value isn't 0
NONE bruH Go to the left or right cell or stay at the current cell
NONE BRUH Make enabled true
NONE bruh Make enabled false

Enabled

Some commands work only if enabled(boolean) is true, other work only if enabled is false. Enabled toogle after every command. For example:

   BRUH@make enabled true, but after this command enabled will be toogled, so enabled=false @
   bruH@go to the random (left, right or this) cell, enabled=true@
   bruh@enabled=true@
   Bruh@enabled=false@
   bruh@enabled=true@
   Bruh@enabled=false@
Need in Enabled
Bruh True
bRuh True
BruH True
bRUH True
BRUh True
bruH False
BRuh False
brUH False
BrUh False

Comments

Comments write as usuall commands, because interpreter ignore all symbols, expect of command. So after any comment you have to write @. Otherwise interpreter will ignore next command.

   This is a comment @
   BRUH@BRUH@BRUH@
   code@
   BRUH@This is a comment
   Bruh@<--This command is a part of comment@

BRUH!!!

BRUH!!! at ... is a error, which mean that you try to execute command with invalid enabled (see Enabled).
TOTAL BRUH!!! is a error, which mean that you use to many BRUH or bruh

Examples

Hello, World!

BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@
   BruH@
        bruh@Bruh@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@
        Bruh@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh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uh@BRUH@BRuh@Bruh@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@Bruh@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@Bruh@BRuh@BRUH@BRuh@BRUH@BRuh@bRuh@bruh@bRuh@bruh@bRuh@bruh@bRuh@BRUH@brUH@BRUH@BrUh@Bruh@BRUH@BRuh@BRUH@BRuh@bRUH@bruh@Bruh@BRUH@BRuh@bRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@bRUH@bruh@bRUH@BRuh@BRUH@BRuh@BRUH@BRuh@bRUH@bruh@Bruh@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@bruh@bRUH@bruh@Bruh@BRuh@BRUH@BRuh@bruh@bRUH@bruh@bRuh@bruh@bRuh@bruh@bRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@BRUH@BRuh@bRUH@bruh@Bruh@bruh@bRUH@BRuh@BRUH@BRuh@BRUH@BRuh@bRUH@brUH@BRUH@brUH@BRUH@brUH@BRUH@brUH@BRUH@brUH@BRUH@brUH@bRUH@brUH@BRUH@brUH@BRUH@brUH@BRUH@brUH@BRUH@brUH@BRUH@brUH@BRUH@brUH@BRUH@brUH@bRUH@bruh@Bruh@bruh@Bruh@BRUH@BRuh@bRUH

Interpreter

Java

   import java.io.*;
   import java.util.List;
   import java.util.Random;
   import java.util.Scanner;
   import java.util.Stack;
   
   public class Bruh {
   static List<Byte> stack= new Stack<Byte>();
   static List<Integer> loop = new Stack<Integer>();
   static Scanner scanner = new Scanner(System.in);
   static String input="",file;
   static boolean enabled = true;
   static int pos;
   public static void main(String[] args) {
       file = scanner.nextLine();
       try(FileReader reader = new FileReader(file))
       {
           int c;
           while((c=reader.read())!=-1){
               input+=(char)c;
           }
       }
       catch(IOException ex){
           System.out.println(ex.getMessage());
       }
       Interpret();
   }
   
   public static void Interpret() {
       String[] arr = input.replace("\r\n","")
                           .replace(" ","")
                           .split("@");
       for (var i=0;i<30000;i++){
           stack.add((byte) 0);
       }
       int j=0;
       for (var i=0;i<arr.length;i++)
           switch (arr[i]){ case "BRUH", "bruh" -> j++;}
       if (j>=arr.length/2){
           System.out.println("TOTAL BRUH!!!");
           System.out.print("BR");while(true)System.out.print("U");
       }
       for (var i=0;i<arr.length;i++){
           switch (arr[i]) {
               case "BRUH" ->enabled=true;
               case "bruh" ->enabled=false;
               case "Bruh" -> {
                   if(enabled){if(pos<30000)pos++;}
                   else System.out.println("BRUH!!! at "+i);
               }
               case "bRuh" -> {
                   if(enabled){if(pos>=0)pos--;}
                   else System.out.println("BRUH!!! at "+i);
               }
               case "bruH" -> {
                   if(!enabled)pos += new Random().nextInt(2) - 1;
                   else System.out.println("BRUH!!! at "+i);
               }
               case "BRuh" -> {
                   if(!enabled)stack.set(pos, (byte) (stack.get(pos) + 1));
                   else System.out.println("BRUH!!! at "+i);
               }
               case "brUH" -> {
                   if(!enabled)stack.set(pos, (byte) (stack.get(pos) - 1));
                   else System.out.println("BRUH!!! at "+i);
               }
               case "BruH" -> {
                   if(enabled)loop.add(i);
                   else System.out.println("BRUH!!! at "+i);
               }
               case "BrUh" -> {
                   if(!enabled) {
                       if (stack.get(pos) != 0) {
                           i = loop.get(loop.size() - 1) - 1;
                           loop.remove(loop.size() - 1);
                       }
                   }
                   else System.out.println("BRUH!!! at "+i);
               }
               case "bRUH" -> {
                   if(enabled)System.out.print(Character.toString(stack.get(pos)));
                   else System.out.println("BRUH!!! at "+i);
               }
               case "BRUh" -> {
                   if(enabled)stack.set(pos, (byte) scanner.next().charAt(0));
                   else System.out.println("BRUH!!! at "+i);
               }
               default -> {
                   continue;
               }
           }
           enabled=!enabled;
       }
   }
   }