feat(tvix/eval): implement simple arithmetic binary operations
Implements simple arithmetic operations (+, -, *, /). There is some scaffolding included to pop and coerce pairs of numbers, as the Nix language will let arithmetic operators apply to arbitrary pairs of number types (always resulting in floats if the types are mixed). Change-Id: I5f62c363bdea8baa6ef812cc64c5406759d257cf Reviewed-on: https://cl.tvl.fyi/c/depot/+/6074 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
parent
e96a2934ad
commit
d35ecc0caf
5 changed files with 110 additions and 5 deletions
|
|
@ -12,7 +12,7 @@ pub fn interpret(code: String) -> EvalResult<String> {
|
|||
}
|
||||
|
||||
let mut out = String::new();
|
||||
writeln!(out, "{}", ast.root().dump()).ok();
|
||||
println!("{}", ast.root().dump());
|
||||
|
||||
let code = crate::compiler::compile(ast)?;
|
||||
writeln!(out, "code: {:?}", code).ok();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue