About

InterpreterExamples

Hello, this is my Length interpreter. This interpreter can run regular Length, but it can also transpile my own language to length.


Length

Length is an esoteric programming language created by Nailuj29

If you don't know how it works check out https://esolangs.org/wiki/Length

FAQ about Length

Do line lengths that don't have an instruction get ignored?

Yes, all lines that don't have lengths of valid instructions are ignored.

How does gotou and gotos work?

Gotou and gotos are a bit confusing in Length because gotou indexes lines at 0 while gotos indexes them at 0 but skips a line (effectively indexing lines starting at -1)
Suppose this pseudocode: gotou 0
In that code the next instruction to be executed is the instruction at line 0. (the first line)
Now suppose this pseudocode: gotos
In that pseudocode the gotos instruction will pop the top of the stack and goto that line, but it will skip the instruction at that line, making the next instruction executed be the instruction at the line of the popped value plus 1

My language

My language is a language that transpiles to length, it has all the lenght instructions and a few more.

An instruction in my language might look like this:
outn
Or like this, with an instruction argument:
push 10

My language also has labels, you can define a label like this:
@myLabel:
And if you want to goto that label you can do this:
gotou @myLabel

Here are some instructions that only exist in my language:


print "string\n"

Prints a C-styled string to the output stream

ifeq_gotou @label1

Pops two values from the stack and if they are equal, goes to the specified label