InterpretIt

From Esolang
Jump to navigation Jump to search

InterpretIt is a language by User:Esolangist made for making interpreters in. Strangely, there is no { or }; indentation is the only way to make code readable.

Commands

This section is still a work in progress. It may be changed in the future.

define func(arg,arg2,arg3...):

(code)

This command defines a function.

take code to interpret

Takes input from the user and puts it in the variable "code".

code

Returns the variable "code".

There's more commands but I will add them later

Computational class

This program is a Brainfuck interpreter, proving that InterpretIt is turing complete.

// Brainf*** interpreter by Esolangist
// Enjoy this code.
import /stlibs/Tapes.init
tapes/initialize infinite tape
take code to interpret
if current command is "+":
 tapes/increment
otherwise, if current command is "-":
 tapes/decrement
otherwise, if current command is ">":
 tapes/right
otherwise, if current command is "<":
 tapes/left
otherwise, if current command is ",":
 tapes/input
otherwise, if current command is ".":
 tapes/output
otherwise, if there is a loop pair "[" and "]" with code return being x:
 while tapes/cell == 0:
  run code in loop pair x
otherwise:
 do nothing