Skip to content

pepijndevos/bobcat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bobcat

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.

Syntax

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

Functions

TODO

Types

Status

typedef enum {FAILURE, SUCCESS, RUNNING} Status;

Built-in nodes

seq

int seq_pre(Status*);
int seq(const Status, const Status, Status*);
int seq_post(const Status);

memseq

sel

int sel_pre(Status*);
int sel(const Status, const Status, Status*);
int sel_post(const Status);

memsel

par

mempar

About

A concatenative language for behavior trees

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published