Function parse

Source
pub fn parse(
    handler: Handler,
    node_builder: &NodeBuilder,
    source: &SourceFile,
    modules: &[Rc<SourceFile>],
    network: NetworkName,
) -> Result<Program>
Expand description

Parses the main source file and any associated modules into a Program AST.

§Arguments

  • handler - Used for diagnostics and error reporting.
  • node_builder - Factory for building AST nodes.
  • source - The main source file to parse.
  • modules - A list of module source files (each wrapped in Rc<SourceFile>).
  • network - The Aleo network context (e.g., TestnetV0).

§Returns

  • Ok(Program) - The parsed program including all modules.
  • Err(CompilerError) - If any part of parsing fails.