atoxide-parser 0.1.2

Parser for the Ato hardware description language
Documentation

Parser for the Ato hardware description language.

This crate provides a complete parser for the Ato DSL, producing a typed AST with error recovery using the chumsky parser combinator library.

Example

use atoxide_parser::parse;

let source = r#"
module MyModule:
    pin p1
    signal sig
    p1 ~ sig
"#;

match parse(source) {
    Ok(file) => {
        println!("Parsed {} statements", file.statements.len());
    }
    Err(errors) => {
        for e in errors {
            eprintln!("Parse error: {}", e);
        }
    }
}

Error Recovery

The parser supports error recovery, allowing it to continue parsing after encountering errors. Use parse_with_recovery to get both the AST and errors:

use atoxide_parser::parse_with_recovery;

let source = "module M:\n    pass\n";
let (ast, errors) = parse_with_recovery(source);

if let Some(file) = ast {
    println!("Parsed {} statements", file.statements.len());
}
for error in &errors {
    eprintln!("Error: {}", error);
}