Bundle

From Esolang
Jump to navigation Jump to search

Bundle was a simple esoteric programming language created by Lanksy. Bundle was designed to be used for small programs, like Cat programs or incremental counters, hence its simple interface and shell-like functions, although this did not stop users from building more complex programs, for example FizzBuzz or 99 Bottles of Beer. It was deleted in 6 July 2022 for being hard to maintain.[1]

Lanksy made three revisions of Bundle before it's deleted.

Bundle v1

Bundle
Designed by LankyBox02
Appeared in 2022
Computational class Turing complete
Reference implementation [1](dead link)
File extension(s) None
The Bundle v1 logo.
The Bundle v1 logo.

Bundle (sometimes called Bundle v1) was the first version of Bundle.[2]

The Bundle v1 website features a code-sharing platform.

Syntax

Bundle's commands resemble shell commands, with types of commands written first and seperated from arguments strictly by a space. Commands that use multiple arguments like add or if should not have a space next to their delimiters, lest the space will be included on the argument. Such commands also support arguments in curly brackets to supply a variable as an argument.

Every Bundle code must start with the line start and end with the line end. If not specified, the interpreter will throw the error bad start or bad end.

Bundle commands must always be written in lowercase, except for arguments.

Looping

Bundle programs can be specified to loop by adding loop to the code. When this command is invoked, it marks the program to be run again after it has done executing a cycle.

Commands

Here are the commands of Bundle.

Command Description
add _,_ Adds two arguments and sets the result to the variable res.
sub _,_ Subtracts two arguments and sets the result to the variable res.
mul _,_ Multiplies two arguments and sets the result to the variable res.
div _,_ Divides two arguments and sets the result to the variable res.
charat _,_ Takes the character number from the string and sets the result to the variable res.
hasdec _ Sets the variable res to true if the argument is not a integer.
break Prints a linebreak.
write _ Prints the argument.
writebr _ Prints the argument with a new line.
ask _ Prints the argument and sets the answer to the variable res.
getarr _,_ Gets the value of an array name and position, then sets the result to the variable res.
concat _,_ Joins 2 arrays together, then sets the result to the variable res.
throw _ Prints a variable.
clear Clears the console.
def _=_ Defines a variable.
arr _=_,_,_ Defines an array with values separated by commas (,).
randomize Sets the variable random to a random number between 1 to 10.
rasterize Sets the variable res to the source code.
hash Sets the variable res to a randomised string varying from 9 to 11 characters.
hour Sets the variable res to the current hour.
minute Sets the variable res to the current minute
second Sets the variable res to the current second.
date Sets the variable res to the current day of the month.
pi Sets the variable res to 3.14159.
if _=_ Execute the next command if the condition is met. The != comparison can be used aswell.
loop Loops the entire program regardless of where the command is placed.
endloop Ends the running loop.
length _ Returns the length of the provided argument
username Returns the username of the user.

Example programs

Hello, world!

start
write Hello, world!
end

Cat program

start
ask Input...
throw res
end

Quine

start
rasterize
throw res
end

FizzBuzz

start
if {looping}!=yes
def x=1
if {looping}!=yes
def mod3=1
if {looping}!=yes
def mod5=1
if {looping}!=yes
def looping=yes
if {mod3}=0
write Fizz
if {mod5}=0
write Buzz
if {mod3}!=0
if {mod5}=0
if 0=1
throw x
add {x},1
def x={res}
add {mod3},1
def mod3={res}
if {mod3}=3
def mod3=0
add {mod5},1
def mod5={res}
if {mod5}=5
def mod5=0
break
loop
end

Original program by PkmnQ. (dead link)

99 Bottles of Beer

start
if {init}!=no
def init=yes
if {init}=yes
def a=99
def init=no
if {a}!=1
throw a
if {a}!=1
write  bottles of beer on the wall, ​
if {a}!=1
throw a
if {a}!=1
write  bottles of beer.
if {a}=1
break
if {a}=1
write Take one down and pass it around, 1 bottle of beer on the wall.
if {a}=1
break
if {a}=1
break
if {a}=1
write 1 bottle of beer on the wall, 1 bottle of beer.
if {a}=1
break
if {a}=1
write Take one down and pass it around, no more bottles of beer on the wall.
if {a}=1
break
if {a}=1
break
if {a}=1
write No more bottles of beer on the wall, no more bottles of beer.
if {a}=1
break
if {a}=1
write Go to the store and buy some more, 99 bottles of beer on the wall.
if {a}=1
break
if {a}=1
break
if {a}=1
write 99 bottles of beer on the wall, ​99 bottles of beer.
if {a}=1
def a=99
if {a}!=1
sub {a},1
if {a}!=1
def a={res}
if {a}!=1
break
if {a}!=1
write Take one down and pass it around, ​
if {a}!=1
throw a
if {a}!=1
write  bottles of beer on the wall.
if {a}!=1
break
if {a}!=1
break
if {a}!=1
if {a}!=0
loop

Original program by willy. (dead link)

Computational class

Prior to Bundle v1.2, Bundle is computationally equivalent to a bounded-storage machine, since it can access a finite amount of data, and the def command cannot accept substitutions for determining the variable. Arrays were added to eliminate this limitation quickly before the development for Bundle v2 started, making it Turing complete.

Nevertheless, a bounded-machine compiler has been made before.[3]

Bundle v2

Bundle v2
Designed by LankyBox02
Appeared in 2022
Computational class Unknown
Reference implementation Unimplemented
File extension(s) None

Bundle v2 was the second revision of Bundle. It has less features than Bundle v1 and is harder to use than it in some way.

Syntax

Bundle v2's commands resemble shell commands. Every command must be written in lowercase, except for arguments.

Variables can be embedded into an argument by surrounding the variable name in the following pattern:

${variable}

Commands

username

Will set the variable called res to the username of the person running the bundle. If the user is logged out, will return null.

clear

Will clear the entire console.

loop

Will loop the entire bundle forever.

stoploop

Will stop the loop.

randomise [max]

Will set the variable called res to a random number from 1to the maximum number.

write [text]

Will write the provided text to the console.

writeln [text]

Will write the provided text to the console in a new line.

ask [prompt]

Will ask the provided prompt to the user and set the answer to a variable called res.

def [name] = [value]

Will set a new variable with the name and value provided.

if [value] = [value]

If the comparison provided is true, the next line will run. Otherwise, it will skip the next line. The != comparison can also be used.

+ [name]

Will increment the variable with the name provided.

add [value], [value]

Will add the 2 values together and set the result to a variable called res.

sub [value], [value]

Will subtract the 2 values together and set the result to a variable called res.

mul [value], [value]

Will multiply the 2 values together and set the result to a variable called res.

div [value], [value]

Will divide the 2 values together and set the result to a variable called res.

Bundle v3 beta

Bundle v3 beta was the last revision of Bundle. It shared more or less the same commands as Bundle v2.

Legacy

While this programming language is short-lived, it is popular enough that there's people that made spinoffs of it.

Bundle Reborn

Bundle Reborn was an attempt to resurrect Bundle. It was made by @late on the website wasteof.money, however development of it stopped in around August 2022.

Commands

Bundle Reborn supports the following commands:[4]

Command Description
write [text] write to the console (no new line)
writeln [text] write to the console with a new line
clear clears the console
ask [question] prompts the user with [question]
def [variable] = [value] defines a variable
wait [seconds] pauses the script for [seconds] seconds
[variable] = [new value] sets [variable] to [new value] (only works for defined vars)
random [start] [end] sets "res" to a random number between [start] and [end]
${[variable]} gets [variable] value (if [variable] exists)
# comment

Bundle+

Bundle+ is an extended dialect of Bundle made by User:OllyTheFoldy, designed to be make programming in Bundle easier, while still using a Bundle-like syntax. It's compiled to Bundle v2.[5][note 1]

Additions

Bundle+ added the if ... then statement, the stop command to terminate the program, and the while loop. The command sub for subroutines is also envisioned, however the lack of a stack prevents it from being implemented.

Here's an example program in Bundle+:

def a = 1
def b = 1
while a != 10
+ a
endwhile

if b != 1 then
stop
endif

Stages

The Bundle+ compiler is split into 3 stages, each of them is a seperate dialect:

Bundle + IFs

Bundle + IFs adds ifall and ifany, allowing multiple comparisons to be made. The input of the commands are structured like an array of strings; this is to ease compilation for later stages.

Here's an example program of Bundle + IFs:

def a = 1
def b = 1
ifany ["a=1","b=1"]
write yes
write no

Bundle with GOTOs

Bundle with GOTOs adds goto, which allowed the IP to "jump". Since the interpreter had to loop back to advance a line, execution will take a long time. The -f switch could be added to make the IP advance every line.

Here's an example code in Bundle with GOTOs:

def a = 0
def b = 1
label a
+ a
if a != 5
goto a
label b
+ b
if b != 5
goto b
label c
+ a
if a != 10
goto c
label d
+ b
if b != 10
goto d

Bundle vICEMAQIANEPLSIMIM

Bundle vICEMAQIANEPLSIMIM is a simple Bundle v1 dialect made by PkmnQ.[6] It is made so he can make a quine from it.

Commands

Bundle vICEMAQIANEPLSIMIM supports the commands write, writebr, break, throw, clear, let, arr, getarr, add, sub, mul, div, loop, and if, all of them taken from Bundle v1. Note that the loop here moves the IP to the first line, rather than flagging the code to be looped forever like in normal Bundle.

Bundle Again

Bundle Again
Designed by User:Gilbert189
Appeared in 2022
Computational class Turing complete
Reference implementation [2]
File extension(s) .txt, .bundle, .ba

Bundle Again is a Bundle v1 dialect with a website made to imitate what was the interface of Bundle v1. It is made by User:Gilbert189.

While a code-sharing platform hasn't been implemented, Gilbert had envisioned a way to share Bundle Again codes using GitHub Gists, with the back-end API implemented experimentally here.

Commands

Bundle Again takes commands from Bundle v1 and Bundle Reborn as references for the command set. Some commands has been extended to support multiple inputs, like add and concat.

Here are the commands supported by Bundle Again:[7]

Command Description
def [var]={val} set a value to a variable
copy [orig],[copy] copy value of variable [orig] to [copy]
arr [var]={v1},{v2},... set a comma-seperated array to a variable
getarr [var],{i} get a value of array at specified index and set the value to res
concat [v1],[v2],... concatenates the given variables and set the result to res
length [var] get the length of variable and set the value to res
write {text} outputs the text to the terminal
writeln {text} outputs the text to the terminal with a line break
break output a line break to the terminal
ask [text] prompt for input from user
add {a},{b},... adds the given values and set the result to res
sub {a},{b},... subtracts the given values and set the result to res
mul {a},{b},... multiplies the given values and set the result to res
div {a},{b},... divides the given values and set the result to res
+ [var] increments the given variable
- [var] decrements the given variable
if {val}={val} compares two values together, if it's false then skip the next line (supported operations are =, !=, >, and <)
second get the current second and set the value to res
minute get the current minute and set the value to res
hour get the current hour and set the value to res
day get the current day and set the value to res
month get the current month and set the value to res
year get the current year and set the value to res
random {low},{high} sets res to a random number on interval [low, high]
wait {time} wait for the specified amount of time in seconds
clear clears the console
push {a},{b},... push the given values to the deque
pop pop the value at deque and set the value to res
unshift {a},{b},... enqueue the given values to the deque
shift dequeue the value at deque and set the value to res
//, # comment

Turing completeness

Unlike older versions of Bundle v1, Bundle Again supports variable-size arrays, which makes Bundle Again Turing complete. While there's no easy way to modify an array, it can be done by rebuilding the array from scratch. This is made easier by the deque added in Bundle Again 1.2.

See also

  • BlueFun, the successor of the Bundle family

Notes

  1. A version that compiles to Bundle v1 has been made, but only until stage Bundle with GOTOs.

References