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](dead link)
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(dead link). 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. The pointer cannot move beyond the first cell at the index zero (0).
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 whose first argument is not among rludpwinc are fully ignored by the interpreter, and not executed.

Examples

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.

One-time character-based cat program

A one-time character-based cat program follows:

c0 w0

One-time numeric cat program

This one-time numeric cat program queries the user for an integer number and prints the character whose ASCII code concurs with the input:

n0 w0

Conditional one-time numeric cat program

This one-time numeric cat program queries the user for an integer number and prints the character whose ASCII code concurs with the input if and only if the number did not equal zero (0):

n0 i0 w0

Interpreter

  • Common Lisp implementation of the Targs programming language.