From 404826e78a56e15e20d3938aed80945295921745 Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Sat, 22 Jun 2024 16:45:04 -0600 Subject: Add parser --- src/product.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/product.cpp (limited to 'src/product.cpp') diff --git a/src/product.cpp b/src/product.cpp new file mode 100644 index 0000000..093aff1 --- /dev/null +++ b/src/product.cpp @@ -0,0 +1,11 @@ +#include "include/product.hpp" +#include "include/syntax_tree.hpp" + + +Product::Product(SyntaxTree *left, SyntaxTree *right) + : SyntaxTree{left, right} +{} + +float Product::eval() const { + return left->eval() * right->eval(); +} -- cgit v1.2.3