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 tree

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

Resource visibility defines, who can access the resource.

Imported modules

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 file structure

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.

Resources in subfolders

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.

Module syntax

Syntax used for modules was designed to

You can see lot of ==== and --- in the source code. This is more problem with very short functions. Also we expect to use special editor for module text with built-in pretty printing. An experimental design can be seen here.

Module parsing

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.