Drift

Drift is a procedural, "stack-based" programming language created by Harald Sorenson in 2017. The main premise of the language is where every variable is a stack (filo) or queue (fifo) of positive integers.

Declaration Keywords

 * will declare a first-in-last-out stack.
 * will declare a first-in-first-out stack, also known as a queue.

Destruction Keywords

 * will destroy a variable, and will allow it to be redeclared.

Variable Operators

 * Pushing:  will push onto the stack.
 * Popping:  will return and remove the top/bottom of the stack.
 * Peeking:  will return the top/bottom of the stack.
 * Get Size:  will return the size of the stack.

Logic Keywords

 * and  statements, along with   statements.
 * with  for looping.
 * and  operators with   token to return to   call.

I/O Keywords

 * will print to stdout.
 * will print to stdout with an appended newline.
 * and  keywords to define how to print.
 * will get the first character of user input.
 * will get a line of user input.
 * will get a number from user input.

Arithmetic

 * All arithmetic must be placed within arithmetic blocks
 * Operators currently functional include:,  ,  ,  , and.

Strings

 * to create a string literal, only supported when pushing to a variable.
 * to create a character literal, only supports one character.

Misc

 * One-line comments are declared with a  token.

Hello, World!
fifo str."Hello World!\n" loop { if ?str > 0 { print char ~str }else { break } }

Reverse Cat
Note:  could be replaced with   to make this a normal cat program. filo input.sin loop { if ?input = 0 { print char '\n input.sin }  print char ~input }

Fibonacci Sequence
filo fib.0 fib.1 loop { println int ^fib filo tmp.(~fib) filo sum.(^tmp + ~fib) fib.(~tmp) fib.(~sum) del tmp del sum if ^fib > 100000 {break} }

Label/Gotos
filo arg lbl pstr loop { if ?arg = 0 {break} print char ~arg }  print char '\n ret arg.sin goto pstr

Conditional Loop
filo num.nin if ^num = 0 { exit }else loop if ^num > 0 { if ^num = 0 { break }  println int ^num num.(~num-1) }else { println int ^num }

Deadfish Interpreter
See here or here.