Module is collection of named resources (syntax patterns, functions, values, structures, other modules etc.) and variables. Module can declare some other module as it's parent. When searching for resource or variable, parent will be searched too.
Resource is constant value with assigned identifier. Multiple resources in the same module can use same id. Any type of value may be module resource, among others:
Module can contain other module as an resource. Hierarchy (tree) of modules can be created this way.
Module can define variables (object of record type). Resources (functions) defined in that module can then access this variables (they provide lexical context).
Resource visibility defines, who can access the resource.
Module can use (import) other modules. Imported module is added as resource of type module. If the visibility of the imported module is 'public', all public properties of the imported module are visible outside the importing module.
Module is represented as a filesystem folder. The folder contains main.module file, which represents the module root.
[Why?] The main module.file is not named after the module, because module folder is named after it. This way it is not necessary to rename the module file if you decide to rename the module.
Module folder can contain subfolders. The name of the subfolder then represents name of a type. Every file or folder in that subfolder represents resource of that specified type, named as the name of file (sans extension).
Example module folder with two subfolders:
editor/
main.module
raster/
ok.bmp
cancel.png
logo.jpg
wave/
chord.wav
applause.mp3
module/
print/
main.module
spellcheck/
main.module
The editor module will contain (in addition to resources defined in main.module) following 7 resources: ok, cancel, logo, chord, applause, print and spellcheck.
Syntax used for modules was designed to
When module is loaded, resources are parsed. Some resources may reference other resources (for example functions reference other functions, or syntaxes, structure definitions reference types etc.).
It is not necessary to specify resources in some specific order, Kutululu will resolve the references (inluding recursive references) automatically even between different submodules in the module.