Skip to main content

Crate ferth

Crate ferth 

Source
Expand description

A safe, native sized Forth.

§Features

  • std: Add support for standard input and output.
  • repl: Build the REPL.
  • unsafe: Enable unchecked stack access optimizations.
use ferth::Ferth;
use ferth::host::NullHost;

let mut fe = Ferth::new([0u8; 65536], NullHost).unwrap();
fe.evaluate("
: square ( n -- n ) dup * ;
2 dup square dup square dup square
").unwrap();
assert_eq!(fe.stack().count(), 4);
assert_eq!(fe.stack().collect::<Vec<_>>(), vec![2, 4, 16, 256]);

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

double
Forth double types, sized for the target system.
error
Error and result types.
host
Host traits and implementations.
time
Date and time.

Structs§

Config
System environment configuration.
Ferth
The Forth system.

Constants§

FALSE
Boolean false. A cell with no bits set (0).
SIZE
The size of a cell in bytes.
TRUE
Boolean true. A cell with all bits set (usize::MAX).