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 an unclear reason.

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

Bundle v1

Bundle
Designed by LankyBox02
Appeared in 2022
Computational class Bounded-storage machine
Reference implementation [1](dead link)
File extension(s) None

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

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.

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.
arr _=_ Creates an array with values separated by commas (,).
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.
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
end

Original program by willy. (dead link)

Turing-completeness

Since Bundle can only access a finite amount of data, and the def command cannot accept substitutions for determining the variable, it is in fact a bounded-storage machine. Arrays was probably added to eliminate this limitation, but it is half-implemened before Bundle was upgraded to v2. Nevertheless, a bounded-machine compiler has been made before.[2]

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 commands resembles 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 wasteof, however development of it stopped in around August 2022.

Commands

Bundle Reborn supports these commands:[3]

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.[4][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.[5] 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.

Notes

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

References