// Test bytecode compiler expression parsing // This tests bc_compile() which is called from C // Simple arithmetic let x = 1 + 2 * 3; console.log("1 + 2 * 3 =", x); // 7 // Unary operators let y = -5; let z = !true; console.log("-5 =", y, "!true =", z); // Comparison let cmp = 5 > 3; console.log("5 > 3 =", cmp); // Ternary let tern = true ? "yes" : "no"; console.log("true ? 'yes' : 'no' =", tern); // Short-circuit let or_result = false || "default"; let and_result = true && "value"; console.log("false || 'default' =", or_result); console.log("true && 'value' =", and_result); // Object literal let obj = { a: 1, b: 2 }; console.log("obj.a =", obj.a, "obj.b =", obj.b); // Array literal let arr = [1, 2, 3]; console.log("arr[0] =", arr[0], "arr.length =", arr.length); // Function call console.log("Math.max(1, 5, 3) =", Math.max(1, 5, 3)); // Member access let str = "hello"; console.log("'hello'.length =", str.length); // Nullish coalescing let nullish = null ?? "fallback"; console.log("null ?? 'fallback' =", nullish); // Optional chaining let maybe = { nested: { value: 42 } }; console.log("maybe?.nested?.value =", maybe?.nested?.value); console.log("maybe?.missing?.value =", maybe?.missing?.value); console.log("\nAll expression tests passed!");