Skip to contents

logo

froth is a Forth implementation that runs on top of R. This allows users to enjoy the fun of stack-oriented program from within the comfort of R.

You can start a REPL by running froth() in the terminal. Future additions will add the ability to execute forth scripts.

Running on top of R provides a few key differences relative to other FORTH implementations:

  • Data can contain arbitrary R objects. Froth searches its dictionary, user-defined words, variables, and then R session variables when deciding how to handle each input word.

  • R handling of objects. This means that all numerical inputs are inherently identical to R numbers. No need for double-size values, and division operators use R methods by default (so 3 2 / will return 1.5, not 1)

  • Interpreted loops, meaning loops are supported both inside and outside definitions.

  • No direct memory access.

  • Support for saving arbitrary R objects in variable arrays.

  • Support for R print methods using the .R word.

Usage

## Start a froth REPL
froth()

Value

None; operations within the REPL will only modify the internal froth stack.

Author

Maintainer: Aidan Lakshman ahl27@pitt.edu