| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
An Erlang/OTP implementation of the Forthic stack-based concatenative programming language.
Forthic is a stack-based, concatenative language designed for composable transformations. This is the official Erlang runtime implementation, providing full compatibility with other Forthic runtimes and leveraging the power of OTP for distributed computing.
rebar3 compile%% Start the application
application:start(forthic).
%% Create an interpreter
{ok, Interp} = forthic_interpreter:new().
%% Run Forthic code
{ok, Result} = forthic_interpreter:run(Interp, "[1 2 3] \"2 *\" MAP").
%% Get result from stack
Value = forthic_interpreter:stack_pop(Interp).
%% Value = [2, 4, 6]# REPL mode
./forthic repl
# Execute a script
./forthic run script.forthic
# Eval mode (one-liner)
./forthic eval "[1 2 3] LENGTH"# Compile
rebar3 compile
# Run tests
rebar3 eunit
# Run specific test
rebar3 eunit --module=forthic_interpreter_test
# Run with property-based testing
rebar3 proper
# Start shell with application loaded
rebar3 shellforthic-erl/ ├── src/ │ ├── forthic.app.src # OTP application │ ├── forthic_app.erl # Application behavior │ ├── forthic_sup.erl # Supervisor │ ├── forthic_interpreter.erl # Core interpreter │ ├── forthic_tokenizer.erl # Lexical analysis │ ├── forthic_module.erl # Module system │ └── modules/standard/ # Standard library (8 modules) ├── test/ # EUnit tests └── priv/ # Resources
The Forthic runtime is a proper OTP application with supervision:
%% Supervised interpreter process
{ok, Pid} = forthic_interpreter:start_link().
%% Execute in process
gen_server:call(Pid, {run, "[1 2 3] REVERSE"}).Leverage distributed erlang for multi-node Forthic execution:
%% Execute on remote node
rpc:call('node@host', forthic_interpreter, run, [Interp, Code]).This runtime supports calling words from other Forthic runtimes via gRPC:
%% Call a Java word from Erlang
{ok, Result} = forthic_grpc_client:execute_word(
"java-runtime", "MY-WORD", Args
).BSD 2-CLAUSE
| Back | FazBrowse Home | New Git URL |