Build a golfing language with me

2. Score: 2938 2583

The modified interpreter is here on TIO.

String literal is the most obvious addition to the language, mainly to combat kolmogorov-complexity challenges.

Solutions

1. "Hello, World!" - 20 bytes (-28)

#"Hello, World!"[o>]

Any kolmogorov-complexity challenge can be completed using the structure #"<string>"[o>] which outputs the given string until the 0 after the string is reached.

2. 1, 2, Fizz, 4, Buzz - 419 64 bytes (-1332)

$1[1+1s:3s%{}"zziF"oooos;0s]:5s%{}"zzuB"oooos;0s]s{:O}]10o:100-]

Thanks to @user202729 for awesome golfing on this.

3. Produce the number 2014 without any numbers in your source code - 9 bytes (-4)

#"ĒĎ"[O>]

Uses the two chars 20 and 14 in Bugle codepoints.

4. Obfuscated Hello World - 19 bytes (-153)

#"Ifmmp!Xpsme"[-o>]

Meets rules #1 (no HLWDhlwd) and #3 (no 27).

5. Sing Happy Birthday to your favourite programming language - 98 bytes (-230)

#"Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear Bugle
Happy Birthday to You"[o>]

6. We're no strangers to code golf, you know the rules, and so do I - 1887 bytes (-5006)

#"We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

We've known each other for so long
Your heart's been aching but
You're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it
And if you ask me how I'm feeling
Don't tell me you're too blind to see

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

(Ooh, give you up)
(Ooh, give you up)
(Ooh)
Never gonna give, never gonna give
(Give you up)
(Ooh)
Never gonna give, never gonna give
(Give you up)

We've know each other for so long
Your heart's been aching but
You're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it

I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you"[o>]

16. Bake a slice of Pi - 149 bytes (-290)

#"()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|"[o>]

20. Golf you a quine for great good! - 62 bytes (-12)

#"[>]<o-o+[<]>[o>]<-o;<[<]>[o>]#"[>]<o-o+[<]>[o>]<-o;<[<]>[o>]

Added Language Feature

  • "...": String literal.
    • Stack / Deque: Push the Bugle codepoints of each char to the top / front of the stack / deque.
    • Tape / Grid: Write the Bugle codepoints of each char onto the tape / grid to the right, starting from the current cell. Does not move the cursor.
    • \n is handled just like other chars.
    • There is no escaped character for now, so you can't write " (34) to the memory using this command. It's not too big of a problem, at least for now, since all of the kolmogorov-complexity challenges listed here don't have " in the output.

Any further golfing is always welcome, especially for "Never gonna give you up" and the quine. Specifically, the above quine is very first nontrivial quine I ever made, so I strongly believe someone can come up with a shorter one.


3. Score: 2938 2583 2532 (-51)

The new interpreter is here.

Mainly for the purposes of golfing the quine and making output easier, I've added the ability to duplicate the stack/deque and also to output the entire model in rendered text form instead of as integers.

Solutions

1. "Hello, World!" - 17 bytes (-3)

#"Hello, World!"a

5. Sing Happy Birthday to your favourite programming language - 95 bytes (-3)

#"Happy Birthday to You
Happy Birthday to You
Happy Birthday Dear Bugle
Happy Birthday to You"a

6. We're no strangers to code golf, you know the rules, and so do I - 1884 bytes (-3)

#"We're no strangers to love
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

We've known each other for so long
Your heart's been aching but
You're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it
And if you ask me how I'm feeling
Don't tell me you're too blind to see

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

(Ooh, give you up)
(Ooh, give you up)
(Ooh)
Never gonna give, never gonna give
(Give you up)
(Ooh)
Never gonna give, never gonna give
(Give you up)

We've know each other for so long
Your heart's been aching but
You're too shy to say it
Inside we both know what's been going on
We know the game and we're gonna play it

I just wanna tell you how I'm feeling
Gotta make you understand

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you

Never gonna give you up
Never gonna let you down
Never gonna run around and desert you
Never gonna make you cry
Never gonna say goodbye
Never gonna tell a lie and hurt you"a

16. Bake a slice of Pi - 149 bytes (-3)

#"()()()()()()
|\3.1415926|
|:\53589793|
\::\2384626|
 \::\433832|
  \::\79502|
   \::\8841|
    \::\971|
     \::\69|
      \::\3|
       \__\|"a

20. Golf you a quine for great good! - 23 bytes (-39)

$"R34RdR36Ra"R34RdR36Ra

Added Language Features

  • a

    • All: Print the entire model as text, e.g. #"Hello, World!"a prints Hello, World!
  • d

    • Stack/Deque: Push the stack on top of itself.

1. Score: 9638

The base interpreter can be found here, and the submissions here. It's rather long, so I've included it on GitHub, rather than take up most of the post.

Solutions

All of these solutions are the Unicode programs, run with the -u command line flag, but the scores are counted as though encoded with Bugle's code page.

1. "Hello, World!" - 48 bytes

$72o101o108o108o111o44o32o87o111o114o108o100o33o

Simply push then output the character code of each character in the string.

2. 1, 2, Fizz, 4, Buzz - 1396 bytes

$49o10o50o10o70o105o122o122o10o52o10o66o117o122o122o10o70o105o122o122o10o55o10o56o10o70o105o122o122o10o66o117o122o122o10o49o49o10o70o105o122o122o10o49o51o10o49o52o10o70o105o122o122o66o117o122o122o10o49o54o10o49o55o10o70o105o122o122o10o49o57o10o66o117o122o122o10o70o105o122o122o10o50o50o10o50o51o10o70o105o122o122o10o66o117o122o122o10o50o54o10o70o105o122o122o10o50o56o10o50o57o10o70o105o122o122o66o117o122o122o10o51o49o10o51o50o10o70o105o122o122o10o51o52o10o66o117o122o122o10o70o105o122o122o10o51o55o10o51o56o10o70o105o122o122o10o66o117o122o122o10o52o49o10o70o105o122o122o10o52o51o10o52o52o10o70o105o122o122o66o117o122o122o10o52o54o10o52o55o10o70o105o122o122o10o52o57o10o66o117o122o122o10o70o105o122o122o10o53o50o10o53o51o10o70o105o122o122o10o66o117o122o122o10o53o54o10o70o105o122o122o10o53o56o10o53o57o10o70o105o122o122o66o117o122o122o10o54o49o10o54o50o10o70o105o122o122o10o54o52o10o66o117o122o122o10o70o105o122o122o10o54o55o10o54o56o10o70o105o122o122o10o66o117o122o122o10o55o49o10o70o105o122o122o10o55o51o10o55o52o10o70o105o122o122o66o117o122o122o10o55o54o10o55o55o10o70o105o122o122o10o55o57o10o66o117o122o122o10o70o105o122o122o10o56o50o10o56o51o10o70o105o122o122o10o66o117o122o122o10o56o54o10o70o105o122o122o10o56o56o10o56o57o10o70o105o122o122o66o117o122o122o10o57o49o10o57o50o10o70o105o122o122o10o57o52o10o66o117o122o122o10o70o105o122o122o10o57o55o10o57o56o10o70o105o122o122o10o66o117o122o122o

Same technique as the Hello, World! example

3. Produce the number 2014 without any numbers in your source code - 13 bytes

#++O--O+O+++O

# uses the tape, + increments the cell, O outputs as an integer and - decrements

4. Obfuscated Hello World - 172 bytes

#+++++++++[>++++++++<-]>o<++++[>+++++++<-]>+o+++++++oo+++o>++++[>+++++++++++<-]>o------------o[-]++++++++[>+++++++++++<-]>-o<<<o+++o------o--------o[-]+++[>+++++++++++<-]>o

Uses its inherent similarity to brainfuck. Meets rules #1 and #3

5. Sing Happy Birthday to your favourite programming language - 328 bytes

$72o97o112o112o121o32o66o105o114o116o104o100o97o121o32o116o111o32o89o111o117o10o72o97o112o112o121o32o66o105o114o116o104o100o97o121o32o116o111o32o89o111o117o10o72o97o112o112o121o32o66o105o114o116o104o100o97o121o32o68o101o97o114o32o66o117o103o108o101o10o72o97o112o112o121o32o66o105o114o116o104o100o97o121o32o116o111o32o89o111o117o

All the kolmogorov-complexity challenges have this kind of structure, at the moment.

6. We're no strangers to code golf, you know the rules, and so do I - 6893 bytes

$87o101o39o114o101o32o110o111o32o115o116o114o97o110o103o101o114o115o32o116o111o32o108o111o118o101o10o89o111o117o32o107o110o111o119o32o116o104o101o32o114o117o108o101o115o32o97o110o100o32o115o111o32o100o111o32o73o10o65o32o102o117o108o108o32o99o111o109o109o105o116o109o101o110o116o39o115o32o119o104o97o116o32o73o39o109o32o116o104o105o110o107o105o110o103o32o111o102o10o89o111o117o32o119o111o117o108o100o110o39o116o32o103o101o116o32o116o104o105o115o32o102o114o111o109o32o97o110o121o32o111o116o104o101o114o32o103o117o121o10o73o32o106o117o115o116o32o119o97o110o110o97o32o116o101o108o108o32o121o111o117o32o104o111o119o32o73o39o109o32o102o101o101o108o105o110o103o10o71o111o116o116o97o32o109o97o107o101o32o121o111o117o32o117o110o100o101o114o115o116o97o110o100o10o32o10o78o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o32o121o111o117o32o117o112o10o78o101o118o101o114o32o103o111o110o110o97o32o108o101o116o32o121o111o117o32o100o111o119o110o10o78o101o118o101o114o32o103o111o110o110o97o32o114o117o110o32o97o114o111o117o110o100o32o97o110o100o32o100o101o115o101o114o116o32o121o111o117o10o78o101o118o101o114o32o103o111o110o110o97o32o109o97o107o101o32o121o111o117o32o99o114o121o10o78o101o118o101o114o32o103o111o110o110o97o32o115o97o121o32o103o111o111o100o98o121o101o10o78o101o118o101o114o32o103o111o110o110o97o32o116o101o108o108o32o97o32o108o105o101o32o97o110o100o32o104o117o114o116o32o121o111o117o10o32o10o87o101o39o118o101o32o107o110o111o119o110o32o101o97o99o104o32o111o116o104o101o114o32o102o111o114o32o115o111o32o108o111o110o103o10o89o111o117o114o32o104o101o97o114o116o39o115o32o98o101o101o110o32o97o99o104o105o110o103o32o98o117o116o10o89o111o117o39o114o101o32o116o111o111o32o115o104o121o32o116o111o32o115o97o121o32o105o116o10o73o110o115o105o100o101o32o119o101o32o98o111o116o104o32o107o110o111o119o32o119o104o97o116o39o115o32o98o101o101o110o32o103o111o105o110o103o32o111o110o10o87o101o32o107o110o111o119o32o116o104o101o32o103o97o109o101o32o97o110o100o32o119o101o39o114o101o32o103o111o110o110o97o32o112o108o97o121o32o105o116o10o65o110o100o32o105o102o32o121o111o117o32o97o115o107o32o109o101o32o104o111o119o32o73o39o109o32o102o101o101o108o105o110o103o10o68o111o110o39o116o32o116o101o108o108o32o109o101o32o121o111o117o39o114o101o32o116o111o111o32o98o108o105o110o100o32o116o111o32o115o101o101o10o32o10o78o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o32o121o111o117o32o117o112o10o78o101o118o101o114o32o103o111o110o110o97o32o108o101o116o32o121o111o117o32o100o111o119o110o10o78o101o118o101o114o32o103o111o110o110o97o32o114o117o110o32o97o114o111o117o110o100o32o97o110o100o32o100o101o115o101o114o116o32o121o111o117o10o78o101o118o101o114o32o103o111o110o110o97o32o109o97o107o101o32o121o111o117o32o99o114o121o10o78o101o118o101o114o32o103o111o110o110o97o32o115o97o121o32o103o111o111o100o98o121o101o10o78o101o118o101o114o32o103o111o110o110o97o32o116o101o108o108o32o97o32o108o105o101o32o97o110o100o32o104o117o114o116o32o121o111o117o10o32o10o78o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o32o121o111o117o32o117o112o10o78o101o118o101o114o32o103o111o110o110o97o32o108o101o116o32o121o111o117o32o100o111o119o110o10o78o101o118o101o114o32o103o111o110o110o97o32o114o117o110o32o97o114o111o117o110o100o32o97o110o100o32o100o101o115o101o114o116o32o121o111o117o10o78o101o118o101o114o32o103o111o110o110o97o32o109o97o107o101o32o121o111o117o32o99o114o121o10o78o101o118o101o114o32o103o111o110o110o97o32o115o97o121o32o103o111o111o100o98o121o101o10o78o101o118o101o114o32o103o111o110o110o97o32o116o101o108o108o32o97o32o108o105o101o32o97o110o100o32o104o117o114o116o32o121o111o117o10o32o10o40o79o111o104o44o32o103o105o118o101o32o121o111o117o32o117o112o41o10o40o79o111o104o44o32o103o105o118o101o32o121o111o117o32o117o112o41o10o40o79o111o104o41o10o78o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o44o32o110o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o10o40o71o105o118o101o32o121o111o117o32o117o112o41o10o40o79o111o104o41o10o78o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o44o32o110o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o10o40o71o105o118o101o32o121o111o117o32o117o112o41o10o32o10o87o101o39o118o101o32o107o110o111o119o32o101o97o99o104o32o111o116o104o101o114o32o102o111o114o32o115o111o32o108o111o110o103o10o89o111o117o114o32o104o101o97o114o116o39o115o32o98o101o101o110o32o97o99o104o105o110o103o32o98o117o116o10o89o111o117o39o114o101o32o116o111o111o32o115o104o121o32o116o111o32o115o97o121o32o105o116o10o73o110o115o105o100o101o32o119o101o32o98o111o116o104o32o107o110o111o119o32o119o104o97o116o39o115o32o98o101o101o110o32o103o111o105o110o103o32o111o110o10o87o101o32o107o110o111o119o32o116o104o101o32o103o97o109o101o32o97o110o100o32o119o101o39o114o101o32o103o111o110o110o97o32o112o108o97o121o32o105o116o10o32o10o73o32o106o117o115o116o32o119o97o110o110o97o32o116o101o108o108o32o121o111o117o32o104o111o119o32o73o39o109o32o102o101o101o108o105o110o103o10o71o111o116o116o97o32o109o97o107o101o32o121o111o117o32o117o110o100o101o114o115o116o97o110o100o10o32o10o78o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o32o121o111o117o32o117o112o10o78o101o118o101o114o32o103o111o110o110o97o32o108o101o116o32o121o111o117o32o100o111o119o110o10o78o101o118o101o114o32o103o111o110o110o97o32o114o117o110o32o97o114o111o117o110o100o32o97o110o100o32o100o101o115o101o114o116o32o121o111o117o10o78o101o118o101o114o32o103o111o110o110o97o32o109o97o107o101o32o121o111o117o32o99o114o121o10o78o101o118o101o114o32o103o111o110o110o97o32o115o97o121o32o103o111o111o100o98o121o101o10o78o101o118o101o114o32o103o111o110o110o97o32o116o101o108o108o32o97o32o108o105o101o32o97o110o100o32o104o117o114o116o32o121o111o117o10o32o10o78o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o32o121o111o117o32o117o112o10o78o101o118o101o114o32o103o111o110o110o97o32o108o101o116o32o121o111o117o32o100o111o119o110o10o78o101o118o101o114o32o103o111o110o110o97o32o114o117o110o32o97o114o111o117o110o100o32o97o110o100o32o100o101o115o101o114o116o32o121o111o117o10o78o101o118o101o114o32o103o111o110o110o97o32o109o97o107o101o32o121o111o117o32o99o114o121o10o78o101o118o101o114o32o103o111o110o110o97o32o115o97o121o32o103o111o111o100o98o121o101o10o78o101o118o101o114o32o103o111o110o110o97o32o116o101o108o108o32o97o32o108o105o101o32o97o110o100o32o104o117o114o116o32o121o111o117o10o32o10o78o101o118o101o114o32o103o111o110o110o97o32o103o105o118o101o32o121o111o117o32o117o112o10o78o101o118o101o114o32o103o111o110o110o97o32o108o101o116o32o121o111o117o32o100o111o119o110o10o78o101o118o101o114o32o103o111o110o110o97o32o114o117o110o32o97o114o111o117o110o100o32o97o110o100o32o100o101o115o101o114o116o32o121o111o117o10o78o101o118o101o114o32o103o111o110o110o97o32o109o97o107o101o32o121o111o117o32o99o114o121o10o78o101o118o101o114o32o103o111o110o110o97o32o115o97o121o32o103o111o111o100o98o121o101o10o78o101o118o101o114o32o103o111o110o110o97o32o116o101o108o108o32o97o32o108o105o101o32o97o110o100o32o104o117o114o116o32o121o111o117o

7. Output the sign - 18 bytes

$?:Zs0=0s-s:1s-++O

Checks if the input is greater than zero, less than zero (changed to yield -1 instead of 1) and equal to zero, before taking their sum.

8. Collatz Conjecture (OEIS A006577) - 36 bytes

#$?:1-[:2s%{3×1+}2s÷]:1s-₀+₁]₀O

This performs the looping on the stack, but switches over to the tape to increment the count each iteration.

9. An Array of Challenges #1: Alternating Arrays - 35 bytes

#?>?>+>?[[<+<<->>>-]+<[-<<]>[>]?]<O

This is a slight modification of Mitch Schwartz's answer to the existing challenge, go upvote that!

10. Am I an insignificant array? - 46 bytes

$1 0-?…1[s:sr-:Z1s-2×1+×1s-Z1-L2s-×]1+Z1-O

All credit goes to Emigna for making this

11. Is this number a prime? - 31 bytes

$?:1s-:[:1s-:];L1s[×L2s-]:×%O

Uses Wilson's Theorem and calculates (n-1)!² % n

12. I'm a palindrome. Are you? - 13 bytes

$?:R=:O:=R:?$

The first half of the program, up to O, sets the stack up as [x, x] where x is either True or False. O pops the top value and outputs it. The rest of the program just makes sure that no errors are produced. Luckily, when ? encounters the end of the file, it just pushes '' (the empty string).

13. Sum the numbers on standard in - 19 bytes

$?:[?:];L0s[+L1s-]O

This can be split into two parts: ?:[?:]; and L0s[+L1s-]. The first part collects all input to the stack. The second part pushes the sum of the top two elements, while the length is greater than 1.

14. Find the Factorial - 25 bytes

$?:[:1s-:];L1s-Z[×L1s-]O

This has a similar structure to the sum program, but instead of pushing ltiple inputs, the [:1s-:]; pushes the range from 1 .. n to the stack, and [×L1s-] takes the product.

15. Shortest code to produce infinite output - 5 bytes

#+[O]

Use a while loop, with the 1 continually under the pointer. Outputs 1 forever.

16. Bake a slice of Pi - 439 bytes

$40o41o40o41o40o41o40o41o40o41o40o41o10o124o92o51o46o49o52o49o53o57o50o54o124o10o124o58o92o53o51o53o56o57o55o57o51o124o10o92o58o58o92o50o51o56o52o54o50o54o124o10o32o92o58o58o92o52o51o51o56o51o50o124o10o32o32o92o58o58o92o55o57o53o48o50o124o10o32o32o32o92o58o58o92o56o56o52o49o124o10o32o32o32o32o92o58o58o92o57o55o49o124o10o32o32o32o32o32o92o58o58o92o54o57o124o10o32o32o32o32o32o32o92o58o58o92o51o124o10o32o32o32o32o32o32o32o92o95o95o92o124o

17. Find the smallest number that doesn't divide N

$?:1:[:rs%0=s1+srr:Rs]1s-O

This uses trial division, terminating when the result of the modulo does not equal 0.

18. Is this even or odd? - 5 bytes

$2?%O

Simple modulo by 2

19. Output with the same length as the code - 16 bytes

$16:[32+:o33s-:]

Outputs the first 16 printable ASCII characters in reverse: 0/.-,+*)('&%$#"!

20. Golf you a quine for great good!

$1[93, 76, 111, 91, 49, 59, 104, 48, 79, 49, 111, 54, 51, 0]
36o1O0h;1[oL]

Credit goes to user202729 for making this


Language specification

Calling

bugle.py currently takes a series of flags, then the file name / code to be executed. As of yet, it has 4 command line flags:

  • -f/--file specifies that code is to be read from a file
  • -c/--cmd/--cmdline specifies that code is supplied via the command line.

    -c and -f cannot be used in the same call

  • -u/--unicode tells the interpreter to read the code with the Unicode encoding. The default is to use Bugle's encoding below

  • -l/--length outputs the length of the file, in bytes, to STDERR after execution

The following call was used to test the above submissions

$ python bugle.py -f -u [file]

Code page

Bugle uses 512 characters in its code page. The 0xFF character is not to be used for a command, as its used to indicate that the next hex value in to index into the second half of the code page. The characters used are:

ÀÁÂÄÆÃÅĀĄ\t\nĆČÇĎÐ
ÈÉÊËĒĖĚĘÌÍÎÏĪĮĹĽ
 !"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
`abcdefghijklmno
pqrstuvwxyz{|}~¶
ŁŃŇÑŊÒÓÔÖŒÕØŌŔŘŚ
ŠŤŦÙÚÛÜŮŪŴÝŶŸŹŽŻ
àáâäæãåāąćčçďðèé
êëēėěęìíîïīįĺľłń
ňñŋòóôöœøōõŕřßśš
ťŧùúûüůūŵýŷÿźžż◊
ΑΆΒΓΔΕΈΖΗΉΘΙΊΚΛΜ
ΝΞΟΌΠΡΣΤΥΎΦΧΨΩΏ
αάβγδεέζηήθιίΐκλ
μνξοόπσςτυύΰφχψω
ώǴḰḾṔẂǵḱḿṕẃḂḞĠḢṀ
ȮṖṠṪẊḃḟġḣṁȯṗṡṫẋ§
ĂĞĬŎŬĴăğĭŏŭĵªº‹›
ƁƇƊƑƓƘⱮƝƤƬƲȤɓƈɗƒ
ɠɦƙɱɲƥʠɼʂƭʋȥ©®ıȷ
ЉЊЕРТЗУИОПШАСДФГ
ХЈКЛЧЋЅЏЦВБНМЂЖљ
њертзуиопшасдфгх
јклчћѕџцвбнмђжÞþ
†∂∆≈≠√∈∉∌∋∩∪¬∧∨⊕
¤₽¥£¢€₩‰¿¡⁇⁈‼⁉‽⸘
…°•”“„’‘≤«·»≥ᴇ∞¦
×⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾
÷₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎

Or see it in table format. Note that \t and \n represent tab and newline respectively. Also take note that the 16th line ends with an unprintable character: , and may not be displayed on all browsers.

Memory

The interpreter currently has 5 memory models built in to it. Each memory model requires a character to tell the interpreter to begin using that model:

  • Stack ($): a standard stack, which supports values being pushed, popped etc.
  • Infinite tape (#): A tape, à la brainfuck, which initially is only 0s.
  • Infinite grid (G): A 2d grid, infinite in both directions, containing only 0s
  • Deque (D): A deque, as implemented by the collections module.
  • Register (S): A single value, which can be used to store one value.

The grid also has a single value saved in its pointer that can be written to, or write to cells.

In addition, tape and grid sizes and wrapping behaviour can be modified, by using a different invoke command. These different commands take a given number of values from the current memory model as customisation parameters:

  • Tape (À): Takes two values - size (int) and wrapping (bool)
  • Tape (Á): Takes one value - size (int). Wraps at end of the tape
  • Tape (Â): Takes one value - size (int). Doesn't wrap at the end
  • Grid (Ǵ): Takes 4 values - x size (int), y size (int), x wrap (bool) and y wrap (bool)

The memory type being used can change during a program by the use of ₀₁₂₃₄₅₆₇₈₉, which access the 0-indexed nth used memory type ( is the first, is the second etc.), but, currently, values cannot be swapped between different memory types.

Branching

So far Bugle has two branching commands, both terminated with a ] character:

  • While ([): brainfuck-style while loops. These pop a value from the stack/deque if being used, or access the cell under the pointer in tape/grid.

    Example: #?[-O] counts from the input down to 0

  • If/else ({ and }). Single execution while loops. If the value popped is false, then the if clause is skipped, going to the else clause, separated by }. They behave the same way as while loops regarding memory access.

    Example: {0}1] is a logical NOT gate

Builtin functions

Runs of digits are interpreted as integers, and are just pushed/written to the current memory model as is.

Obviously, I've equipped Bugle with some basic builtin functions, as few as I could, to allow others to add more as the chain progresses. The base commands are as follows:

  • +

    • Stack/Deque: Add the top two values
    • Tape/Grid: Increment the current cell
  • -

    • Stack/Deque: Subtract the top two values
    • Tape/Grid: Decrement the current cell
  • %

    • Stack/Deque: Modulo the top two values
  • :

    • Stack/Deque: Duplicate the top value
  • ;

    • Stack/Deque: Pop the top value
    • Tape/Grid: Zero the current cell
  • <

    • Tape/Grid: Move left one cell
  • =

    • Stack: Are the top two values equal?
    • Grid: Move down one cell
  • >

    • Tape/Grid: Move right one cell
  • ?

    • Stack/Deque: Evaluate a line of input
    • Tape/Grid: Take a character of input
  • L

    • Stack/Deque: Push the length of the stack/deque
  • O

    • All: Output the current value
  • R

    • Stack: Reverse the top element if possible, else reverse the stack
  • Z

    • Stack: Top element is positive?
  • ^

    • Grid: Move up one cell
  • h

    • All: Print the full memory model
  • o

    • All: Print the current value as a character
  • r

    • Stack: Rotate the top 3 values
    • Deque: Rotate the deque n times, where n is the top value
  • s

    • Stack/Deque: Swap the top two values
    • Stack: Splat the top value
  • ×

    • Stack: Multiply the top two values
    • Grid: Write the pointer value to the current cell
  • ÷

    • Stack: Divide the top two values
    • Grid: Write the current cell to the pointer value