Function parse_file

Source
pub fn parse_file(path: &str) -> Result<Program, Error>
Expand description

Parses a Tx3 source file into a Program AST.

§Arguments

  • path - Path to the Tx3 source file to parse

§Returns

  • Result<Program, Error> - The parsed Program AST or an error

§Errors

Returns an error if:

  • The file cannot be read
  • The file contents are not valid Tx3 syntax
  • The AST construction fails

§Example

use tx3_lang::loading::parse_file;
let program = parse_file("path/to/program.tx3").unwrap();