froth-parse-source {froth} | R Documentation |
Function to run froth code from R.
froth.parse(inputline)
froth.source(filepath)
inputline |
A string to parse with froth |
filepath |
Path to a file containing froth or FORTH code to parse with froth |
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.
Invisibly returns an integer status code, with 0 corresponding to normal execution.
Aidan Lakshman ahl27@pitt.edu
## 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')