Bussin X

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Disclamer: This programming language (and article) contains swears.

Bussin and Bussin X are both programming languages made by FaceDev (face-hh on GitHub). Bussin is a normal programming language and Bussin X is an esoteric weirdlang. It is the star of the video "I made my own Programming Language".

Bussin, Bussin X
Paradigm(s) imperative, procedural, declarative
Designed by FaceDev (@FaceDevStuff)
Appeared in 2023
Type system dynamic, gradual, weak (types do literally nothing)
Memory system variable-based
Computational class Turing complete
Reference implementation Bussin
Influenced by Brainfuck, DreamBerd, Rust
File extension(s) .bs, .bsx

Bussin

This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Bussin is a normal, JavaScript-like programming language.

Bussin
Paradigm(s) imperative, procedural, declarative
Designed by FaceDev (@FaceDevStuff)
Appeared in 2023
Type system dynamic, gradual, weak (types do literally nothing)
Memory system variable-based
Computational class Turing complete
Reference implementation Bussin
Influenced by Brainfuck, DreamBerd, Rust
File extension(s) .bs

Syntax

Bussin syntax is very similar to that of JavaScript.

Functions

Functions in Bussin can be defined like so:

fn fn_name(arg1, arg2, arg3... argN) {
    // function body
}

Example:

fn square(x) {
    x * x
}

Like Rust, the last value evaluated in a function is the return value of the function.

Bussin X

Bussin X is the esoteric alter-ego of Bussin, and is also a superset of Bussin. It is the main focus of the video and this article.

Bussin X
Paradigm(s) imperative, procedural, declarative
Designed by FaceDev (@FaceDevStuff)
Appeared in 2023
Type system dynamic, gradual, weak (types do literally nothing)
Memory system variable-based
Computational class Turing complete
Reference implementation Bussin X
Influenced by Brainfuck, DreamBerd, Rust
File extension(s) .bsx

Syntax

Bussin X's syntax is based off of Gen Z slang and replaces keywords and operators with slang terms.

All Bussin code is valid in Bussin X, but not vice versa.

Keywords

Here is the list of keywords in Bussin X.

be beminus beplus betimes btw bruh
cap carenot condition
find_out fr fuck_around
impostor
lit
mf minus minusminus
nah nocap null
ornot
plus plusplus
rn
smol sus
times then thicc
yall

Operators

Operation Bussin X
x + y x plus y
x - y x minus y
x * y x times y
x / y [idk]
x += y x beplus y
x -= y x beminus y
x *= y x betimes y
x -= y [idk]
x++ x plusplus
x-- x minusminus
x == y x fr y
x != y x nah y
x > y x thicc y
x < y x smol y
x || y (Logical OR) x carenot y
x && y x btw y

If Statements

If statements in Bussin X are simple. if is replaced by sus and else is replaced by impostor.

Example:

sus (1 fr 1) {
    waffle("1 is 1")
} impostor sus (2 fr 2) {
    waffle("You broke it but 2 is 2")
} impostor {
    waffle("You broke it")
}

Ternary Operators

Ternary operators in Bussin X are similar to that of C-style languages. The format of a ternary operator is:

<condition> then <true_value> ornot <false_value>

Example:

waffle(1 thicc 0 then "1 > 0" ornot "You broke it")

Loops

Bussin X only supports for-loops, and doesn't support keywords like continue or break.

For loops in Bussin X are C-style for loops, formatted like this:

yall (lit i be 0 rn i smol 10 rn i plusplus) {
    // loop body
}

Try Catch

In Bussin X, try catch statements are supported with fuck_around and find_out.

Here is an example from the README:

fuck_around {
    waffle(null plus hogrider)
} find_out {
    waffle(error)
}
Cannot resolve 'hogrider' as it does not exist.

Note: error is a global variable and not the result of find_out.

Functions

Functions in Bussin X are special values that can execute code and return a value.

Example of a function declaration:

bruh square(x) {
    x times x
}

Like in Rust, the last value evaluated in a function is its return value.

Example from the README:

bruh perform(x, y) {
    x plus y // will do nothing
    x minus y
}

Anonymous functions are also supported, as shown in this README example:

yap("watcho name > ")(bruh(x) {
    waffle(x)
})

Values

Numbers

Like JavaScript and some other scripting languages, Bussin X has one type for IEEE 754 double-precision floating point values. In simpler terms, Bussin X only supports decimals and has no "pure" integer type.

Here are some examples of numeric literals:

3.14159
1234
-9876
0.54321
314.0

Booleans

Booleans represent the concept of true and false. In Bussin X, there are two boolean literals: nocap for true and cap for false.

Strings

Strings in Bussin X are just JavaScript strings. Strings are a sequence of characters that internally, are just an array of bytes.

String literals are created by a pair of quotation marks " with the content of the string in between.

"Hello, World!"

Interpolation

String interpolation in Bussin X is the same as in JavaScript, however with a minor difference.

Formatting a string is done by placing format placeholders (${}) at where you want the interpolated content to show up, and using the format function to interpolate the values into the string.

waffle(
    format("Hello, ${}", "World!")
)

You can also use your regional currency symbol in place of the dollar sign, as shown in this example taken from the README.

// All print "Hello, World"
waffle(format("Hello, ${}", "World"))
waffle(format("Hello, ¥{}", "World"))
waffle(format("Hello, {}€", "World"))
waffle(format("Hello, {}£", "World"))

Concatenation

String concatenation in Bussin X can be done with strcon that directly concatenates (adds) the arguments to the end of the string.

waffle(format("100 squared is ", 100 * 100))

trim("string")

Removes trailing whitespace from the string.

lit string be "       Hello, World!      " rn
lit trimmed be trim(string) rn

waffle(trimmed) // Hello, World!

splitstr("string", "separator")

Returns an array containing the string separated by the separator character.

lit string be "1,2,3,4,5" rn

waffle(splitstr(string, ",")) // ["1", "2", "3", "4", "5"]

parseNumber("string")

Parses a number from a string.

lit num_string be "3.14159" rn

waffle(parseNumber(num_string)) // 3.14159

Objects

Objects in Bussin X are like dictionaries in other languages. Object literals are repeated key-value pairs enveloped in a pair of braces.

Here is an example: lit face_dev_projects be { bussin_x: "Bussin X", yappacino: "Yappacino" } rn

Keys can be get and set with the obj.key syntax.

Keys can be dynamically set with the objects.set(obj, "key", <value>) function, where objects is a global variable, obj is the object you want to modify, and "key" is your key of choice, and <value> is the value you want to assign to the key.

Example:

lit video be { title: "I made my own Programming Language", author: "FaceDev", video: "none"} rn

objects.set(video, "video", "video.mp4")

The objects..hasKey(obj, "key") function can be used to check if a key exists, and the objects.keys(obj) function can be used to get all of the object's keys as an array.

Here is an example taken from the README:

lit x be cap rn
lit obj be { key: nocap, x } rn

obj.key be cap
waffle(obj.key) // false

objects.get(obj, "key") // e.g. true
objects.set(obj, "key", nocap)

objects.hasKey(obj, "key") // e.g. true
objects.keys(obj) // e.g. ["key1", "key2", "key3"]

Arrays

Arrays are like objects but without keys. An array literal can be declared like this:

[value1, value2, value3... valueN]

Here is an example from the README:

lit arr be [ 1, 2, 3, 4 ] rn

arr[0] = 5

waffle(arr) // [5, 2, 3, 4]

Like most other programming languages, Bussin X's arrays are zero-based, meaning that indices start at zero and end at length - 1. Also, array elements can be accessed and modified by subscripting them with array[index].

Variables

Variables in Bussin X are containers for values stored in scopes. Variables are defined with the lit keyword, following a format like this:

lit <var> be <value> rn

Where <var> is the name of the variable (a valid identifier) and <value> is the value you want to assign to the variable.

Here is an example:

lit i be nocap rn

Bussin X also supports constants that can be declared with mf instead of lit.

mf constant be nocap rn

Extras

Input/Output (IO)

IO in Bussin X is handled with the waffle and yap functions.

waffle(args)

Prints the arguments to standard output.

Example:

waffle("Bussin X is lit🗣️💯🔥")

=== yap("text")

Receives input from the user.

Example:

yap("gimme your bank account info")(bruh(x) {
    waffle(x) // print the user's input
    waffle("thanks")
})

Command Line

clapback("command")

Bussin X supports running terminal commands with the clapback() function.

Note: Clapback will throw an error if the command raises an error or fails. Because of this, it should be paired with fuck_around and find_out.

Example:

bruh remove_french_language_pack() {
    // hate to ruin the joke but 'sudo rm -fr /' on Linux and UNIX-like systems like macOS
    // forcibly deletes the root directory, which would delete the whole operating system
    // as well as clearing all synchronized cloud storage and connected storage devices like
    // USB drives, hard drives, and SSDs.
    //
    // forunately, modern Linux distros (e.g. recent Ubuntu distros) are smart enough to not
    // let you do it, requiring you to use '--no-preserve-root' which makes it work.
    //
    // I am not
    // responsible for any damages caused by you running any variations of this command on
    // your operating system.
    //
    // Here are the variations of 'sudo rm -fr /' with and without '--no-preserve-root'
    // that do the same thing
    //
    // sudo rm -r -f /
    // sudo rm -rf /
    // sudo rm -f -r /
    // sudo rm -fr /
    //
    // sudo rm -r -f / --no-preserve-root
    // sudo rm -rf / --no-preserve-root
    // sudo rm -f -r / --no-preserve-root
    // sudo rm -fr / --no-preserve-root
    
    fuck_around {
        lit result = clapback("sudo rm -fr /")
        
        waffle("womp womp")
    } find_out {
        waffle(error, ":(")
    }
}

yap("Remove the French language pack (y/n) > ")(bruh(x) {
    sus (x == "y") {
        waffle("ok")
        remove_french_language_pack()
    } impostor sus (x == "n") {
        waffle("I wasnt asking bro")
        remove_french_language_pack()
    } impostor {
        waffle("What are you yapping about bro")
        remove french_language_pack()
    }
})

Math (nerd)

The math helper in Bussin X is represented by the nerd variable.

Here is an example taken from the README:

waffle(nerd.random(0, 100)) // integer from 0-100
waffle(nerd.sqrt(144)) // 12
waffle(nerd.pi) // 3.141592653589793
waffle(nerd.e) // 2.718281828459045

waffle(nerd.ceil(3.4)) // 4
waffle(nerd.round(3.9)) // 4
waffle(nerd.abs(-2)) // 2

Time

Time in Bussin X can be accessed with time() which returns the current time.

Bussin Object Notation

Bussin Object Notation (BSON) is a special feature that can be used with the bson object.

Example from the README:

bson.parse("{\"a\": 1, \"b\": 2, \"c\": 3}") // {a: 1, b: 2, c: 3}
bson.parse("[1, 2, 3]") // [1, 2, 3]
bson.stringify({a: 1, b: 2, c: 3}) // '{"a": 1, "b": 2, "c": 3}'
bson.stringify([1, 2, 3]) // "[1, 2, 3]"

External Resources