From d35ecc0caf2d6ba54b5934f606796687303275b0 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 8 Aug 2022 02:16:28 +0300 Subject: 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 --- tvix/eval/src/opcode.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tvix/eval/src/opcode.rs') diff --git a/tvix/eval/src/opcode.rs b/tvix/eval/src/opcode.rs index b43f75efaa8f..307b695f6d9b 100644 --- a/tvix/eval/src/opcode.rs +++ b/tvix/eval/src/opcode.rs @@ -16,4 +16,10 @@ pub enum OpCode { OpNull, OpTrue, OpFalse, + + // Simple binary operators + OpAdd, + OpSub, + OpMul, + OpDiv, } -- cgit 1.4.1