Behaviour
Paradigm(s) | imperative |
---|---|
Designed by | Lince Lazuli |
Appeared in | 2021 |
Computational class | Turing complete |
Reference implementation | Behaviour |
File extension(s) | .bhv , .behaviour |
Behaviour is an esoteric programming language invented in 2021 by Lince Lazuli with the objective of making a scripting language that mimics the Behaviour Tree used in artificial intelligence and robotics. This article may call Behaviour a scripting language because the original idea for Behaviour is that it is supposed to run from inside a host program.
Language overview
In Behaviour every command is an Expression. Every expression is converted to a Node when parsed, and said nodes can be evaluated.
So a script in Behaviour is converted to a Tree of expression and subexpressions that are evaluated according to the rules of the Nodes, which are based on the Nodes from the Behaviour Tree.
For example, to run several commands in succession we use a "Sequencer" with all the command inside of it:
(value=10; value+=2; value>100)
Or, if we want to take the value of the first expression to succeed (evaluates truthy) we use a "Selector":
[a>10; b>=20; c<0]
Examples
Hello, World!
@"Hello, World!"
Factorial
factorial = &[1|a<2 a * factorial:a-1]