Skip to content

Modules and Directives

Overview

Modules and directives organize Larol code into manageable units.

Syntax

import "stdlib";
include "utils.lrl";

Rules

Import Directives

The compiler MUST search for the specified library in implementation-defined directories. The import string MUST NOT include a file name extension.

Include Directives

The compiler MUST search for the specified file relative to the directory of the current file. The include string MUST include a file name extension. The implementation MUST fully process the included file before continuing compilation of the current file.

File Extension

Larol source files MUST use the .lrl file extension.

Shared Semantics

import and include differ only in where the file is located. In all other respects their semantics are identical. Only exported declarations from the imported or included file MUST become available to the current file.

Placement

import and include directives MUST only appear at the top level of a compilation unit. They MAY appear in any order relative to other top-level declarations.

Duplicate Directives

Duplicate import or include directives for the same file MUST be silently ignored. The implementation MAY emit a warning for duplicate directives.

Name Uniqueness

All exported identifiers made available through import or include directives MUST be unique within the global scope of the current compilation unit. Naming collisions MUST result in a compile-time error.