If you want to label a Forth program as Standard Program, you must document which wordsets the program uses.
The ans-report.fs tool makes it easy for you to determine which
words from which wordset and which non-standard words your application
uses. You simply have to include ans-report.fs before loading the
program you want to check. After loading your program, you can get the
print-ans-report. A typical use is to run this as
batch job like this:
gforth ans-report.fs myprog.fs -e "print-ans-report bye"
The output looks like this (for compat/control.fs):
The program uses the following words from CORE : : POSTPONE THEN ; immediate ?dup IF 0= from BLOCK-EXT : \ from FILE : (
ans-report.fs reports both Forth-94 and Forth-2012 wordsets.
For words that are in both standards, it reports the wordset without
CORE-EXT). For Forth-2012-only words, it reports
the wordset with a
-2012 suffix (e.g.,
and likewise for the words that are Forth-94-only (i.e., that have
been removed in Forth-2012).
Note that ans-report.fs just checks which words are used, not whether they are used in a standard-conforming way!
Some words are defined in several wordsets in the
standard. ans-report.fs reports them for only one of the
wordsets, and not necessarily the one you expect. It depends on usage
which wordset is the right one to specify. E.g., if you only use the
compilation semantics of
S", it is a Core word; if you also use
its interpretation semantics, it is a File word.