Expand description
Source code parsing
A source file on disc is just a bunch of UTF-8 encoded text which must be parsed before any processing:
use microcad_lang::{syntax::*, parse::*};
let source_file = SourceFile::load("my.µcad").expect("parsing success");To read a source file from an already loaded string use:
use microcad_lang::{syntax::*, parse::*};
let source_file = SourceFile::load_from_str("test", "test.µcad", r#"std::print("hello world!");"#).expect("parsing success");To “run” the source file (and get the expected output) it must now be resolved and evaluated (see crate::resolve and crate::eval) .
Macros§
- find_
rule - Find rule or use default with proper error handling.
- find_
rule_ exact - Find rule and return definition or
ParseError::NotAvailablewith proper error handling. - find_
rule_ opt - Find rule and return optional with proper error handling.
Enums§
- Parse
Error - Parsing errors
Functions§
- find_
rule - Find rule with proper error handling.
Type Aliases§
- Parse
Result - Result with parse error