Documentation for syntax unit assembled from the following pages:

Language documentation: Syntax §

From Syntax

(Syntax) Syntax unit unit §

There are several types of package, each declared with a keyword, a name, some optional traits, and a body of subroutines, methods, or rules.

package P { }
 
module M { }
 
class C { }
 
role R { }
 
grammar G { }

Several packages may be declared in a single file. However, you can declare a unit package at the start of the file (preceded only by comments or use statements), and the rest of the file will be taken as being the body of the package. In this case, the curly braces are not required.

unit module M;
# ... stuff goes here instead of in {}'s