| Title: | Run 'FOCAL' Language Source Code |
|---|---|
| Description: | Execute 'FOCAL' (<https://en.wikipedia.org/wiki/FOCAL_(programming_language)>) source code directly in 'R'. This is achieved by translating 'FOCAL' code into equivalent 'R' commands and controlling the sequence of execution. |
| Authors: | Carl Witthoft [aut, cre] |
| Maintainer: | Carl Witthoft <[email protected]> |
| License: | LGPL-3 |
| Version: | 1.0 |
| Built: | 2026-05-28 09:05:14 UTC |
| Source: | https://github.com/cran/rFocal |
Execute 'FOCAL' (<https://en.wikipedia.org/wiki/FOCAL_(programming_language)>) source code directly in 'R'. This is achieved by translating 'FOCAL' code into equivalent 'R' commands and controlling the sequence of execution.
| Package: | rFocal |
| Type: | Package |
| Title: | Run 'FOCAL' Language Source Code |
| Version: | 1.0 |
| Date: | 2025-05-04 |
| Authors@R: | c(person(given = "Carl", family = "Witthoft", role = c("aut","cre"), email= "[email protected]")) |
| Description: | Execute 'FOCAL' (<https://en.wikipedia.org/wiki/FOCAL_(programming_language)>) source code directly in 'R'. This is achieved by translating 'FOCAL' code into equivalent 'R' commands and controlling the sequence of execution. |
| License: | LGPL-3 |
| Imports: | utils, methods |
| NeedsCompilation: | no |
| Packaged: | 2025-05-23 20:45:57 UTC; cgw |
| Author: | Carl Witthoft [aut, cre] |
| Maintainer: | Carl Witthoft <[email protected]> |
| Repository: | https://cran.r-universe.dev |
| Date/Publication: | 2025-05-27 09:00:02 UTC |
| RemoteUrl: | https://github.com/cran/rFocal |
| RemoteRef: | HEAD |
| RemoteSha: | dea13d15fe65e4cd023cbadff6267ed233fc5db3 |
Index of help topics:
rFocal Run FOCAL Code in R rFocal-package Run 'FOCAL' Language Source Code
Carl Witthoft [aut, cre] Maintainer: Carl Witthoft <[email protected]>
rFocal is an interpreter function. It takes as input FOCAL commands and macros and executes the intended operations in R.
rFocal(focFile, rFile, runit=TRUE, saveit = FALSE)rFocal(focFile, rFile, runit=TRUE, saveit = FALSE)
focFile |
Any of the following:
– a text file containing valid FOCAL commands, including the line numbers.
– a character string or vector of character strings containing valid FOCAL commands,
including the line numbers.
– an R object of class "focfile" , generated in a previous call to |
rFile |
A character string providing the name of a file to be created which will contain
the interpreted code and associated tables. If left empty, this name is generated from
the input |
runit |
If |
saveit |
If |
The FOCAL language was created in the prehistoric times before lower-case letters were available on computers. rFocal is case-insensitive with respect to the input code, should anyone wish to write new source FOCAL code.
The original FOCAL character set included an up-arrow to indicate exponentiation.
Given the number of different UTF-8 up-arrows available, rFocal does not support this
item. The user must replace it with "^" in any source code.
Some FOCAL commmands are unsupported because they have no functionality in the R environment. These commands, including ERASE, MODIFY, GO, if found in the input, are captured as "comment" lines.
The FOCAL floating-point formatting syntax is ignored at this time.
Future revisions may incorporate this feature.
A list object of class focfile, containing the following.
code |
A vector containing the R code equivalent to each FOCAL command. |
retidx |
An array of index values used to control the sequence of R commans executed |
strnum |
An array of the FOCAL line numbers |
newvar |
A collection of variable names created by the interpreter. This is used
to re-create environment variables if the output is invoked in a future |
Carl Witthoft, [email protected]
See <https://en.wikipedia.org/wiki/FOCAL_(programming_language)> for a brief overview. The original 1968 manual can be found at <http://www.bitsavers.org/www.computer.museum.uq.edu.au/pdf/DEC-08-AJAB-D
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or standard data sets, see data(). focloop <- '1.1 FOR KK = 0,5 ; TYPE "KK SQUARED IS " , KK*KK, !' rFocal(focloop) focvals <- c('1.1 SET X = 3','1.2 SET Y = 5','1.3 TYPE "X AND Y",!','1.4 TYPE X, Y') rFocal(focvals)##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or standard data sets, see data(). focloop <- '1.1 FOR KK = 0,5 ; TYPE "KK SQUARED IS " , KK*KK, !' rFocal(focloop) focvals <- c('1.1 SET X = 3','1.2 SET Y = 5','1.3 TYPE "X AND Y",!','1.4 TYPE X, Y') rFocal(focvals)