Maybe Later

Maybe Later is a high level esoteric programming language that revolves around events, rather than a more traditional flow of control, developed by user:TehFlaminTaco. It's syntax is strongly inspired by both Lua and Javascript.
== Overview ==
MaybeLater uses a scoped 'variable' memory model, everything is either stored in a local or global variable or a table which has limited support. The variable types available are:
* Number: A number stored as a Double.
* String: A list of characters, can be manipulated in a similar way to a table.
* Table: A table of values assigned to keys that can be used to store and retrieve more values.
* Event: An action that can be Hooked to, called, or destroyed.
Other variable types may be accessible due to flaws in implementation, but are not considered a formal part of the language.
Flow of control is handled entirely with when<event>{<statements>}, with the exception of if<condition>{<statements>}else{<statements>} blocks. For example, one could print a string when x is set to 3 with the following code
 when x is 3{
 print "Hello, world!"
 }
This functionality can be used similar to function definitions of other languages, although arguments generally must be either taken as variables within the same scope, as explicit arguments cannot be passed.
Maybe Later is also very Whitespace Optional, which means that tokens that look like variable names will match greedily, for example, printa will match print(a) rather than the variable of the name "printa".
== Expressions ==
Expressions in Maybe Later take the following forms:
* Assignment [local|var] <variable> = <expression> : Sets the variable in the local or global scope to the value of the expression. Calls any events hooked to it, and then returns the final value of the variable.
* Arithmetic <expression> <operator> <expression>: Basic math is entirely possible, and will be processed Right to Left.
* When Statement when <event><block>: Hooks a block to an event, to be called alongside it.
* If Block if <condition><block>[<else><block>]: An if block does one thing if the value passed to it is "truthy", or optionally if it isn't.
* Is <varible> is <expression|*>: Creates and binds an event to the variable supplied. When the value of the variable is set to the value of the expression (Which is instantly executed, not every time), or if the value of "expression" is *, then the event is fired.
* Time Passed <expression> <timeunit> pass|passed: Creates an event that fires after the value of the expression time passed.
== Built-ins ==
The language features a few built in functions, which can be called with func expression or func(arguments, argument, argument...)
* print | printline: Write the text provided with a trailing newline to STDOUT.
* write: Write just the text to STDOUT.
* writebyte: Write the character with the character code of the provided input to STDOUT.
* ord | ordinal | byte: Return the number value of the first character of the input string.
* chr | character: Return a single character string based off the inputted number.
* destroy: Stop an event from firing again.
* eval | exec | run | do: Execute the contents of the inputted string as MaybeLater code.
== Examples ==
===Hello, World!===
This prints "Hello, World!" with a newline exactly.
 print "Hello, World!"
===Cat program===
This is a very simple cat program.
 print readall a
===Truth-machine===
 when n is "1"
 {
 	print 1;
 	n = "1B";
 }
 when n is "1B"
 {
 	n = "1";
 }
 when n is "0"
 {
 	print "0";
 	n = "";
 }
 local n = read a;
===Fibonacci===
This prints the nth Fibonacci number, 1 indexed.
 local fibin = 0;
 when fib is 0{
 	local inp = fibin;
 	if(inp < 2){
 		fib = 1
 	}else{
 		fibin = inp - 1;
 		local a = fib = 0;
 		fibin = inp - 2;
 		local b = fib = 0;
 		fib = a + b;
 	}
 }
 
 fibin = read a
 print fib = 0
== External Resources ==
* Github repository.
* TryItOnline interpreter.
Category:Languages
Category:High-level
Category:Implemented
Category:Turing complete
Category:2017