ChainForth.jl

Virtual machine for programmable APIs and blockchains
Author tisztamo
Popularity
0 Stars
Updated Last
3 Years Ago
Started In
May 2021

ChainForth.jl

Lifecycle

ChainForth.jl is an embedded virtual machine that helps you provide a highly secure but programmable, Turing-complete API layer at the edge of your Julia projects.

It is a simple Forth-like environment interpreted (in the future hopefully also JIT-ed) in Julia, which you can easily extend in native Julia to provide an API to the scripts, and which you can easily extend by specifying your DSL in ChainForth itself.

The following example shows the use of an ad-hoc query language created with ChainForth. The example defines the new word (function) Last7Days, that queries some historical data specifying aggregation and selection:

def Last7Days
    HISTORY 5 mins
        STARTAT now 7 days -
        ENDAT now
        FIELDS TimeStamp High
;

The syntax used in this DSL was defined in the language itself.

There is a super-minimal repl:

julia> using ChainForth

julia> ChainForth.repl()
ChainForth.jl v"0 dev":
: double 2 * ;
 ok
: quadruple double double ;
 ok
3 quadruple .
12 ok

ProgrammableAPI.jl is a way to integrate this into your project.

Please read the source and the tests for more info.