From 9b60cf334cdb030759c54f700d5c122338c5b3a8 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 29 Jul 2021 23:56:42 -0700 Subject: Chapter 15.3.1 --- clox/src/main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'clox/src/main.c') diff --git a/clox/src/main.c b/clox/src/main.c index d2cb6bd..d1e747f 100644 --- a/clox/src/main.c +++ b/clox/src/main.c @@ -12,6 +12,18 @@ int main(int argc, const char *argv[]) { int constant = addConstant(&chunk, 1.2); writeChunk(&chunk, OP_CONSTANT, 123); writeChunk(&chunk, constant, 123); + + constant = addConstant(&chunk, 3.4); + writeChunk(&chunk, OP_CONSTANT, 123); + writeChunk(&chunk, constant, 123); + + writeChunk(&chunk, OP_ADD, 123); + + constant = addConstant(&chunk, 5.6); + writeChunk(&chunk, OP_CONSTANT, 123); + writeChunk(&chunk, constant, 123); + + writeChunk(&chunk, OP_DIVIDE, 123); writeChunk(&chunk, OP_NEGATE, 123); writeChunk(&chunk, OP_RETURN, 123); -- cgit v1.2.3-54-g00ecf