Add variable resolution; the error behavior is pretty bad here.

This commit is contained in:
2022-02-20 21:08:01 -08:00
parent f45488b9af
commit 9d82c8ca2d
12 changed files with 549 additions and 36 deletions

View File

@@ -38,13 +38,14 @@ impl FromStr for Program {
#[test]
fn order_of_operations() {
let muladd1 = "1 + 2 * 3;";
let muladd1 = "x = 1 + 2 * 3;";
let testfile = 0;
assert_eq!(
Program::from_str(muladd1).unwrap(),
Program {
statements: vec![Statement::Expr(
statements: vec![Statement::Binding(
Location::InFile(testfile, 0),
"x".to_string(),
Expression::Primitive(
Location::InFile(testfile, 2),
"+".to_string(),