Lorem Ipsum

From Esolang
Jump to navigation Jump to search

Lorem Ipsum is an esoteric programming language created by User:Yayimhere, based off of the concept that every command, after running, pushes itself to the top of the stack. It has some similarities to both Underload, Splinter, and 7, though it is still quite unique. It requires extensive juggling of the side effects of each push, making the language almost impossible to use. It was designed to use a system as simple as it could, while still making it possible to use despite the command pushing side effects.

Memory

Lorem Ipsum has two locations to hold memory. One is an unbounded stack of strings, each string technically a program, and the other is 26 "registers", also holding strings, named A through Z(uppercase). These strings are of course also programs. There is also a pointer pointing to the "selected" register.

Full width commands

Every normal command(which will be listed below) has a full width counterpart. There are three categories, {...}(...)[...], which push {...}, (...), and [...], and then swap the top two items of the stack. NSXPBTFV all push their half width counterparts, and then swap the top two items of the stack. And last A, where A is one of the registers, pushes .A, and then swap the top two items of the stack.

Commands

Unlike the above, these do all push themselves, after they have run.

  • N: Does nothing.
  • (...): Push whats in the brackets.
  • S: Pop top of stack.
  • [...]: pop the top of the stack and save it as x. Then run ..., then x. Then, whatever was popped when running x is pushed back on the stack(in the order of which object popped was deepest in the stack). x does not push itself.
  • X: execute the top of the stack, without popping it.
  • P: append top two items of the stack.
  • B: break out of a [] or {}, also acting as a closing bracket for them. As such, they are pushed, and then * B
  • T: convert the top of stack to its full width version.
  • {...}: run whats in the brackets until the currently selected register(as the one selected within the loop) changes, only checking at the start of the loop. Every check, if a new register has been chosen, it will be checking for change in that one from now on.
  • .A: selects register A.
  • F: pop the top of the stack, and set the current register to that
  • V: execute the currently selected register.

when execution is done, the top of the stack is printed to the screen.

Demonstration

(All full-width chars are bolded for readability)
lets take the program:

(TX)[.A]FV

first, we look at (TX). first, obviously, it pushes TX to the stack. Then, it pushes (TX)(Self pushing). So now the stack looks like:

[TX, (TX)]

then we look at [.A]. First we pop the top of the stack, and name it as x(so x = (TX)). Then, we run .A, which selects register A. Then it self pushes, giving the stack:

[TX, .A]

then, we run , which pops the top of stack(.A), then pushes S, and then .A again. So, this results in the stack being:

[TX, S, .A]

then, we leave the bracketed "block", so we perform the action it does when leaving. First, we run (TX), which has no self pushing, resulting in the stack:

[TX, S, .A, TX]

then we push whatever was popped, but nothing was. Last, we self push [.A] itself. This results in:

[TX, S, .A, TX, [.A]]

then, we run F, which pops the top of the stack([.A]), and sets the currently selected register(A) to that. So now A = [.A]. Then F self pushes, resulting in:

[TX, S, .A, TX, F]

then, we execute A, resulting in [.A] being re-ran, but now we pop F, and set x to that value. So, we get the stack:

[TX, S, .A, TX]

Then, .A runs. It obviously has no effect, since we already have A selected. Then, it self pushes, resulting in:

[TX, S, .A, TX, .A]

Then, we run :

[TX, S, .A, TX, S, .A]

then, the [] block once again ends. So we run x, which is F. So we pop .A, which has no effect, and push it again, since it was popped by F. This leaves the stack identical. Last we push [.A] again, resulting in:

[TX, S, .A, TX, S, .A, [.A]]

which has a sort of alternating pattern between TX, S, and .A, and ending with [.A].