Pointing

:This is a work in progress, expect more soon.
Pointing is a silly language made by Calculus is fun (talk), The basic idea came to me when learning C++ in 2023, what if pointers where the main show?
=Memory=
The memory of Pointing is an array of arbitrarily sized signed integers, the memory is divide as such:
[<orphaned pointers>, ROZ, <empty × ∞>]
The read only zero (ROZ) is indexed as 0, and indices increase to the right.
the memory is "sparse", and can have missing entries
=Instructions=
Notation/Function 	Description
allocate(size) 	Finds a contiguous empty path of the given size, fills the patch with 0s, and returns an orphaned pointer pointing at the first slot, if given 0 or a negative, returns a pointer pointing to the ROZ
free(pointer, size = 0)	sets size number of slots on and after the pointer to empty then deletes pointer, if size is 0 or negative, it only deletes the pointer.
inputInt(pointer) 	pulls an integer from stdin, if a valid number is found, $pointer = <input>;, otherwise does the assignment $pointer = empty
inputStr(pointer) 	pulls a string from stdin stopping at and including the newline character, and preforms the following pointer = allocate(len(<input>)) before assigning the memory values their corresponding character
outputInt(value) 	sends the characters representing <value> when written in decimal to stdout.
outputChar(value) 	send the character corresponding to value to a buffer.
flush() 	sends every character in the buffer to stdout, implicitly called by outputInt and outputChar if the buffer would overfill.
foo 	A name for an orphaned pointer (AKA a pointer to a variable).
$foo 	The value foo is pointing at, can be chained, if desired.
+, -, _, *, /, % 	Addition, subtraction, negation, multiplication, floored division, and modulus, respectively.
¬, ∧, ∨, ⊻ 	Boolean not, and, or, & xor, respectively. These short-circuit.0, empty → false, non-0 → true.
, ^ 	Bitwise not, and, or, & xor.empty → 0
==, <, >, <=, >= 	equality, less than, greater than, less than or equal to, greater than or equal to, respectively
? 	ternary conditional operator
==Expressions==
Expressions are of the following form:
 <expression> := <number> | <global constant> | <identifier> | <unary expression> | <binary expression> | <ternary expression> | <function call>
 <number> := ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9")+
 <global constant> := "true" | "false" | "empty" | "ROZ"
 <unary expression> := ("$" | "_" | "¬" | "~")<expression>
 <binary expression> := ("+" | "-" | "*" | "/" | "%" | "==" | "<" | ">" | "<=" | ">= | "∧" | "∨" | "⊻" | "&" | "|" | "^")<expression><expression> 
 <ternary expression> := "?"<expression><expression><expression>
 <function call> := <function name> "(" <expression>* ")"
:If 2 conflicting parts are back to back, separated them with a comma.
Please notice that expressions are written in Polish notation, this is to decrease the work the compiler/interpreter has to do.
==Statements==
Expressions are good and all, but they don't affect anything. that's where statements come in:
 <statement> := <assignment> | <if> | <while> | <other statements>
 <block> := "{" <statement>+ "}"
 <assignment> := (<expression> | <identifier>) "=" <expression>
 <if> := "if (" <expression> ")" <block>[<else>]
 <else> := "else" (<if> | <block>)
 <while> := "while(" <expression> ")" <block>
 <other statements> = (<expression> | "break"† | "continue"† | "return" <expression>‡)
:† only valid in a while's block
:‡ only valid in a function
Boolean values are nominally -1 and 0 for true and false (taken from FALSE). but for courtesy, any non-zero integer is coerced to -1 when in the <expression> of an <if>, <while>, <do>; both arguments of the boolean operators; or the first argument of ?
==Functions==
Functions are labeled blocks of code, allowing for more sophisticated structures.
 <function> := "function" <identifier> "(" <parameter identifiers>* ")" <block>
=Examples=
==Pointer manipulation==
 i = allocate(1); // creates a pointer to a 0
 p = allocate(0); // create a pointer to ROZ
 $i = 5; //sets value at pointer to 5
 $p = 1; //silently does nothing or throws an error, depending on TBD.
 p = _1; //p is pointing at i;
 outputInt($$p); //5 (see line 3)
==Hello world==
 outputChar(72); //H 
 outputChar(101); //e
 outputChar(108); //l
 outputChar(108); //l
 outputChar(111); //o
 outputChar(44); //,
 outputChar(32); // 
 outputChar(119); //w
 outputChar(111); //o
 outputChar(114); //r
 outputChar(108); //l
 outputChar(100); //d
 outputChar(33); //!
 flush();
==Cat==
 while(-1) {
 inputStr(s);
 //if the string immediately ends
 if (== $s 10) {
 free(s 1);
 break;
 }
 //for each character, output it until you hit a line break
 while (¬ == $s 10) {
 outputChar($s)
 $s = empty;
 s = + s 1;
 }
 // clean up newline
 free(s 1);
 }
==Linked List==
 function length(l) {
 if (== $l empty) {
 return ROZ;
 }
 count = allocate(1);
 i = allocate(0);
 i = l;
 while (¬ == $ + i 1 ROZ) {
 i = $ + i 1;
 $count = + $count 1;
 }
 free(i)
 return count;
 }
 
 function pointerToIndex(l, i) {
 p = allocate(0);
 p = l;
 j = allocate(1);
 $j = $i;
 while (> $j 0) {
 p = $ + p 1;
 $j = + $j 1;
 }
 free(j 1);
 return p;
 }
 
 function push (l, v) {
 //@ is like $, but will free the pointer and its value from accessible memory.
 i <- pointerToIndex(l - @ length(l) 1);
 i = + i 1;
 $i = allocate(2);
 $$i = $v;
 free(i);
 }
 //Todo
Category:Languages 
Category:Unimplemented