froth-parse-source {froth}R Documentation

Read/evaluate froth code from R

Description

Function to run froth code from R.

Usage

froth.parse(inputline)
froth.source(filepath)

Arguments

inputline

A string to parse with froth

filepath

Path to a file containing froth or FORTH code to parse with froth

Details

These functions run the froth interpreter on strings read in either as arguments (froth.parse) or from a file (froth.source). Both functions will run froth code without having to enter the REPL.

Value

Invisibly returns an integer status code, with 0 corresponding to normal execution.

Author(s)

Aidan Lakshman ahl27@pitt.edu

Examples

## Add two numbers
froth.parse("1 2 + .")

## source a function to print a ASCII table called 'rect'
tf <- tempfile()
defn <- ': RECT 256 0 DO I 16 MOD 0= IF CR THEN ." * " LOOP ;'
writeLines(defn, con=tf)
froth.source(tf)
froth.parse('rect')

[Package froth version 1.1.0 Index]