8 releases

Uses old Rust 2015

0.9.0 May 4, 2020
0.8.0 May 3, 2020
0.7.0 Apr 23, 2020
0.6.8 Sep 23, 2022
0.1.26 Jan 21, 2017

#483 in Algorithms

Download history 6/week @ 2024-02-23 56/week @ 2024-03-01

62 downloads per month
Used in rtf

MIT/Apache

400KB
11K SLoC

Rust 7K SLoC // 0.0% comments C 2.5K SLoC // 0.1% comments FORTRAN Legacy 629 SLoC // 0.0% comments Forth 489 SLoC // 0.3% comments F# 229 SLoC Shell 84 SLoC

rtForth

Forth implemented in Rust, designed to be embeddable in real-time applications.

Documentation in traditional Chinese at rtForth 入門.

Design decisions:

  • Safe first, performance later
  • Call threading

Usage of the example program rtf

cargo install --path ./rtf
rtf --help         # Display help information.
rtf <file>         # Load forth commands in <file>.
rtf lib.fth <file>  # Load lib.fth before <file>.
$ rtf              # Execute debug version of rtForth.
rtForth v0.6.6, Copyright (C) 2022 Mapacode Inc.
Type 'bye' or press Ctrl-D to exit.
: star 
   42 emit ;  ok
: stars 
   0 ?do star loop ;  ok
5 stars ***** ok
bye

Use as a Rust crate

rtForth is designed to be used in a real-time system. After startup most of the words other than input and output words do not use system calls.

Input and output words can be implemented by applications according to the operating system used.

See examples/simple.rs and examples/multitask.rs to get know how to embedded rtforth in a rust application.

Dependencies

~1.5MB
~26K SLoC