Targs

From Esolang
Jump to navigation Jump to search
Targs
Paradigm(s) imperative
Designed by User:SpaceByte
Appeared in 2022
Memory system Cell-based
Dimensions one-dimensional
Computational class Unknown
Reference implementation [1]
File extension(s) .tgs

Targs, also known referred to as "EsoTargs" by SpaceByte. The name "Targs" is short for "Two Args" or "Two Arguments" due to how the language contains 2 arguments per command. "Eso" is short for Esoteric.

Language description

Targs operates using commands, split by spaces. Each command in Targs contains two arguments, a command type, and an input, each input in the code is always an integer except when using the pointer to find input, it is never a character or string, any character after the first two in a command will be ignored. Targs' official interpreter was created using C#, and is Open Source here. As of now, the language has 9 commands. The language is heavily inspired by brainfuck, and it contains very similar commands, however, the languages use of multiple arguments separates it from brainfuck,

Commands

Command Description
r Move the pointer right the amount of times specified in the second argument.
l Move the pointer left the amount of times specified in the second argument.
u Add to the value, or "move it up" at the pointer the amount of times specified in the second argument.
d Decrease the value, or "move it down" at the pointer the amount of times specified in the second argument.
p Create a new Console line, and print the character of the ascii value from the integer value of the variable specified by the second argument. If the second argument is p, it uses the pointers location, rather than a specified location.
w Print the character of the ascii value from the integer value of the variable specified by the second argument after the last character printed. If the second argument is p, it uses the pointers location, rather than a specified location.
i If the integer at the position specified in the second argument is true (not 0) execute the next command, otherwise, skip it. If the second argument is p, it uses the pointers location, rather than a specified location.
n Recieve a character as user input, and save it at the position specified as an integer. (If the character can not be properly parsed as an int, default to 0.) If the second argument is p, it uses the pointers location, rather than a specified location.
c Recieve a character as user input, and save it at the position specified as the ascii value of the character. If the second argument is p, it uses the pointers location, rather than a specified location.

All commands which first argument is not rludpwinc are fully ignored by the interpreter, and not executed.

Example

Hello + Hi

This program utilizes every function of the language (excluding user input) to print "hi", and on a new line "Hello". u9 u9 u9 u9 u9 u9 u9 u9 u9 u9 u9 u5 p0 u1 i0 w0 r1 u9 u9 u9 u9 u9 u9 u9 u9 p1 l1 d4 w0 u7 w0 w0 u3 w0 The use of an if command was unnecessary, but still goes through, due to the value at position 0 not being 0. Code may also be on one line, using multiple lines is optional.