← BACK TO CASE STUDIES
GPC Validation Engine in Rust
Rust · Tokio · Regex · TypeScript · React · 2025
Overview
A Rust-based static analysis engine for GPC — a proprietary hardware scripting language with strict syntax rules, no official tooling, and cryptic compiler errors. 41 error codes, auto-fix capabilities, and a rich diagnostic UI.
Error Categories
| Category | Codes | Examples |
|---|---|---|
| Structure | E001-E008 | Brace mismatch, missing main block, duplicate names |
| Syntax | E009-E010, E027-E033 | void → function, ternary operators, string constants |
| Functions | E015 | set_val() value out of range (-100 to 100) |
| OLED | E016-E018 | Coordinate bounds (0-127 x, 0-63 y) |
| Combos | E011-E012 | call() only in combos, wait() bounds |
Auto-Fix in Rust
pub fn apply_fix(code: &str, error: &ValidationError) -> Result<String, String> {
match error.error_code.as_str() {
"E009" => {
let re = Regex::new(r"\bvoid\s+(\w+)\s*\(")?;
Ok(re.replace_all(code, "function $1(").to_string())
},
"E010" => {
let re = Regex::new(r"(#define\s+\w+\s+[^;]+);")?;
Ok(re.replace_all(code, "$1").to_string())
},
}
} Diagnostics Panel
- Build status: PASSED / FAILED / WARNINGS (pulsing indicator)
- Filter pills: All / Errors / Warnings / Tips with counts
- Expandable issue cards with "WHY THIS MATTERS" explanations
- Code health bar (visual percentage)
- "Fix All" batch operation
- Jump-to-line integration with code editor
RustTokioRegexTypeScriptReact