@tention!

From Esolang
Jump to navigation Jump to search

Created by User:Hiant, Fading Entity in November of 2010, @tention!, better known as @!, is based around the idea of a language where all data structures are queues. Below are the commands, their internal representations (as queues!) and a brief description. Note: the " operator is the identity function, and only exists internally.

Commands:		(ABC):	Description:
	AB=		(AB=)	Assignment Operator (sets A to B) This produces a new copy of B called A.
	AB_		(AB_)	Alias Operator (A now represents B)
	A,		(A,")	Undefines A, freeing up memory space.
	(f(x))		(\"")	Lambda Statements (One var only, x)
	AB>		(AB>)	Dequeues from A into B
	AB<		(AB<)	Enqueues B to Queue A
	A~		(A~")	Dequeues from A, then Enqueues to A
	+, -, *, /	(AB+)	Common math statements, work only on integers (Reverse Polish)
	@		(@"")	The empty Queue, for constructing new Queues
	$		($"")	Output Queue (Enqueue results in output)
	&		(&"")	Input Queue (All input is enqueued)
        %               (%"")   Execution Queue. Represents the Queue of all unexecuted commands.
	A{}		(A{})	Repeats Commands in {} A times. If A is zero, {} is not executed.
	;		(;"")	Line separator
	A!		(A!")	Returns Length of A
	A`		(A`")	Peeks into, but does not Dequeue from, A
	A'		(A'")	Character Literal. A is interpreted as its ASCII value.
	A?		(A?")	Returns 1 if A is not 0 or @, otherwise 0.
	A[]		(A[])	Repeats [] while A is 'true'.
	AB#		(AB#)	Equality (A equals B) returns 1 or 0
	AB^		(AB^)	Applies Function B to A (A is interpreted as x in f(x) in B)
        :               (:":)   Enclose comments.

Language Overview

Some peculiarities exist in @!.

  • ALL variables are global, aka no variable scope.
  • Lambda statements may have only one variable, x. As such, no variable may be named x.
  • All variables are single characters. Case-specific.
  • Integer literals are allowed only as single digits.

Example Programs

Turing Completeness Proof

Reduction from brainfuck:

  • Creating the Array (size 256):
		D@=;
		T2=;
		Q(x{TTT*=})=;
		8Q^;
		T{D0<};
                Q,;
                T,;
  • Accessor Function:
		A(D!x-{D~}`)=;
  • Incrementing Function (Pointer):
		X0=;
		I(XX1+=)=;
  • Decrementing Function (Pointer):
		E(XX1-=)=;
  • Altering Functions (Array):
		B(XA^XA^1+=)=;
		C(XA^XA^1-=)=;

By these definitions, reduction is as follows:

Brainfuck                   @!
>                           @I^;
<                           @E^;
+                           @B^;
-                           @C^;
[]                          XA^[];
.                           $XA^<;
,                           &XA^>;

Without spaces or comments:

D@=;T2=;Q(x{TTT*=})=;8Q^;T{D0<};Q,;T,;A(D!x-{D~}`)=;X0=;I(XX1+=)=;E(XX1-=)=;B(XA^XA^1+=)=;C(XA^XA^1-=)=;

Hello_World!

Classic program.

A@=;AH'<;Ae'<;Al'<;Al'<;Ao'<;A_'<;AW'<;Ao'<;Ar'<;Al'<;Ad'<;A!'<;A!{A$>};

Quine

A popular problem.
(Written by User:CodingBat)

S@=;S$'<;SS'<;S''<;S<'<;S;'<;S$'<;S@'<;S''<;S<'<;S;'<;S$'<;S''<;S<'<;S;'<;S$'<;S;'<;S''<;S<'<;S;'<;SS'<;S!'<;S{'<;S$'<;SS'<;S''<;S<'<;S;'<;S$'<;SS'<;S`'<;S<'<;S;'<;S$'<;S''<;S''<;S<'<;S;'<;S$'<;S<'<;S''<;S<'<;S;'<;S$'<;S;'<;S''<;S<'<;S;'<;SS'<;S~'<;S;'<;S}'<;S;'<;SS'<;S!'<;S{'<;S$'<;SS'<;S`'<;S<'<;S;'<;S}'<;S;'<;$S'<;$@'<;$'<;$;'<;S!{$S'<;$S`<;$''<;$<'<;$;'<;S~;};S!{$S`<;};

Examples With %

Here is an interesting example using %. The instruction queue will be show for clarity.

:% = <({TY'=;},{%~;},{TN'=;},{T$>;})<:
TY'=;
:% = <({%~;},{TN'=;},{T$>;})<:
%~;
:% = <({T$>;},{TN'=;})<:
TN'=;
:% = <({TN'=;})<:
T$>;

A puzzle for the reader: What is the value of T at the end of this program?

A(x[%~])=;
3A^;
TY'=;
2A^;
TN'=;
5A^;
%T>;