The main purpose of this code is to find a way to exhibit the subgroup generated by a collection of elements. The subgroup being generated is represented by a counted array or table of bytes. This is a list of the elements found (so far) to be in the subgroup. The first byte is the count, and the remaining bytes are subgroup elements.
The most important top level words in the package are SGfirst ( ele -- ) and SGnext ( ele -- ), which are used to enter the first and subsequent elements. The main words used in implementation are >SGtable ( ele -- ) and SGsweep. >SGtable adds a new element to the table (subgroup) if it is not already there. SGWEEP repeatedly computes products of pairs of elements currently in the subgroup, and uses >SGtable to add the products to the subgroup. This continues until no new elements are added.