diff options
author | 2021-07-29 23:56:42 -0700 | |
---|---|---|
committer | 2021-07-29 23:56:42 -0700 | |
commit | 9b60cf334cdb030759c54f700d5c122338c5b3a8 (patch) | |
tree | bddf5954a6519de2ccfa71b6d665ae64176000e7 /clox/src/main.c | |
parent | 276debcb35a93fee953116694712b2d609c61c32 (diff) | |
download | crafting-interpreters-9b60cf334cdb030759c54f700d5c122338c5b3a8.tar.gz crafting-interpreters-9b60cf334cdb030759c54f700d5c122338c5b3a8.zip |
Chapter 15.3.1
Diffstat (limited to 'clox/src/main.c')
-rw-r--r-- | clox/src/main.c | 12 |
1 files changed, 12 insertions, 0 deletions
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); |