8.1 ans-report.fs: Report the words used, sorted by wordset

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 report with 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 suffix (e.g., CORE-EXT). For Forth-2012-only words, it reports the wordset with a -2012 suffix (e.g., CORE-EXT-2012); and likewise for the words that are Forth-94-only (i.e., that have been removed in Forth-2012).

8.1.1 Caveats

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.