Right bracket

From Esolang
Jump to navigation Jump to search
The title of this article is not correct because of technical limitations. The correct title is actually ].

] is an esoteric programming language made by User:iconmaster after a discussion on the IRC channel. Its main pupose is to make a language with nothing but brackets and parentheses that are unmatched. Needless to say, ] does not accept programs that are all matched brackets.

Description

Only the characters ()<>{}[] are valid ] commands. If all the pairs of a certain type of bracket match, the program is invalid. In ], there is a stack in which to push and pop two symbols: " and '. There is also something called the Metastack, which holds multiple stacks.

Commands

  • ( Pushes a " onto the stack.
  • ) Pushes a ' onto the stack.
  • < Pops a value off the stack.
  • > Swaps the top 2 elements on the stack.
  • { Jumps to the first non-matching } if the top value on the stack is ".
  • } Jumps to the first non-matching (looking backwards) { if the top value on the stack is ".
  • [ Pushes the current stack onto the Metastack.
  • ] Pops a stack from the Metastack and concatenates it to the current stack.

Code Snippets

Duplicate the top element:

{)}}(

Change a ' into ", and vice versa:

(<{<(}}<)

Add " to the stack forever:

({){<(}}{

Implementation

A Lua implementation is available at User:Iconmaster/rb.lua.