Wave Source
EN | KO

<- Back

Rust Guide

This document defines the rules for using Rust in the Wave project.

Rust is the implementation language used during the phase before Wave becomes self-hosted. Even after self-hosting is completed, this document remains valid as a reference; however, the actual implementation of the Wave compiler will no longer be written in Rust.

Rust Version & Edition

The Wave compiler must satisfy the following requirements:

Dependence on newer features or experimental functionality is not permitted.

Naming Conventions

All naming conventions strictly follow the official Rust naming guidelines.

File and Module Size

If a single Rust source file exceeds 5,000 lines, it must be split into smaller modules.

Excessively large files significantly reduce maintainability and readability.

Type Inference

Rust’s type inference is allowed by default.

However, types must be explicitly declared in the following cases:

Macro Usage Rules

User-defined macros are not allowed in the Wave compiler codebase.

The following Rust standard macros are allowed as exceptions:

Excessive macro usage makes code harder to trace and should be especially avoided in compiler development.

Library Usage Rules

Development should primarily rely on the Rust standard library.

The following rules apply:

Unnecessary dependencies negatively impact the long-term maintainability of the Wave compiler.

Code Style

The default code style follows the K&R style.

Exceptions may be allowed when necessary for readability, such as when using the where keyword.

Commenting Rules

Functions that meet any of the following conditions must be documented with comments:

All comments must be written in English.