Background:
Wave includes a Rust-based error crate that defines a detailed error handling system, modeled after Rust's own diagnostic approach.
This system already contains a structured WaveError and WaveErrorKind enum with display logic, supporting error messages, source highlighting, and custom labels.
However, this system is not yet integrated into the compiler or parser pipeline.
Currently, errors are either printed ad-hoc or not standardized, and the error.rs module is left unused.
Goal:
Upgrade and fully integrate the error crate into the Wave compiler so that all parsing, syntax, and semantic errors go through this centralized system.
Example (error.rs):
#[derive(Debug)]
pub enum WaveErrorKind {
UnexpectedToken(String),
ExpectedToken(String),
UnexpectedChar(char),
SyntaxError(String),
}
#[derive(Debug)]
pub struct WaveError {
pub kind: WaveErrorKind,
pub message: String,
pub file: String,
pub line: usize,
pub column: usize,
pub source: Option<String>,
pub label: Option<String>,
}
// with_source(), with_label(), display() already implemented.
Expected Behavior:
- All compiler/parsing errors should be reported using
WaveError::display()
- Errors should show:
- Message
- File / line / column
- Source line (if available)
- Label (if provided)
- Makes Wave error reporting more professional and user-friendly
Tasks:
Additional Information:
-
Language version: - (planned feature, not yet in production)
-
Target branch: develop
-
Inspired by Rust's compiler error format
-
This system will serve as the foundation for future improvements like linting, suggestions, and warnings
Background:
Wave includes a Rust-based
errorcrate that defines a detailed error handling system, modeled after Rust's own diagnostic approach.This system already contains a structured
WaveErrorandWaveErrorKindenum with display logic, supporting error messages, source highlighting, and custom labels.However, this system is not yet integrated into the compiler or parser pipeline.
Currently, errors are either printed ad-hoc or not standardized, and the
error.rsmodule is left unused.Goal:
Upgrade and fully integrate the
errorcrate into the Wave compiler so that all parsing, syntax, and semantic errors go through this centralized system.Example (
error.rs):Expected Behavior:
WaveError::display()Tasks:
WaveErroreprintln!based ad-hoc errorserrorcrate to parsing, tokenizing, and semantic checksResult<T, WaveError>where appropriateAdditional Information:
Language version: - (planned feature, not yet in production)
Target branch:
developInspired by Rust's compiler error format
This system will serve as the foundation for future improvements like linting, suggestions, and warnings