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, with the exception of   blocks. For example, one could print a string when  is set to   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,  will match   rather than the variable of the name "printa".

Expressions
Expressions in Maybe Later take the following forms:
 * Assignment : 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 : Basic math is entirely possible, and will be processed Right to Left.
 * When Statement : Hooks a block to an event, to be called alongside it.
 * If Block : An if block does one thing if the value passed to it is "truthy", or optionally if it isn't.
 * Is : 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 : 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  or


 * : Write the text provided with a trailing newline to STDOUT.
 * : Write just the text to STDOUT.
 * : Write the character with the character code of the provided input to STDOUT.
 * : Return the number value of the first character of the input string.
 * : Return a single character string based off the inputted number.
 * : Stop an event from firing again.
 * : Execute the contents of the inputted string as MaybeLater code.

Examples
This prints "Hello, World!" with a newline exactly. print "Hello, World!"

This is a very simple cat program. print readall a

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.