Skip to main content

parse_text

Function parse_text 

Source
pub fn parse_text(src: &str) -> Result<Program, TextError>
Expand description

Parse the vihaco fn @main grammar into a Program.

Expected format:

version <major>.<minor>;
fn @main() {
  <instruction>
  ...
}

Note: TextError::BadInstruction errors have line: 0 for parse-level failures via vihaco ParsedModule; the underlying chumsky diagnostics are preserved in text even though a precise line number is not yet available.