Bobcat is a tiny concatenative programming language inspired by Cat and Joy with the goal of writing expressive and fast behavior trees.
Bobcat compiles to C, and uses C functions for words. A Bobcat word has the following C signature:
int word(const T input, const T input, ..., T* output, T* output, ...);
Where a non-zero return value returns the outer block.
The usual sequential functional composition
2 dup mul # 4
The comma operator, for function concatentation. Think of it as concatenating the input argument lists and output argument lists of each function.
2 4 dup add,sqrt # 8 1.4142
Quotations, which push a function pointer on the stack. (Currently useless, without some magic sauce)
[ words ]
Function declaration
name: [ word word word ]
Bobcat does not have built-in loops and if statements. It has behavior tree nodes with the following syntax
node( word word word )
Which is roughly equivalent to the following, barring logic for early returns.
node_pre word node word node word node node_post
TODO
typedef enum {FAILURE, SUCCESS, RUNNING} Status;
int seq_pre(Status*);
int seq(const Status, const Status, Status*);
int seq_post(const Status);
int sel_pre(Status*);
int sel(const Status, const Status, Status*);
int sel_post(const Status);