r/Compilers • u/Usual_Office_1740 • Aug 02 '26
CraftingInterpreters clox bytecode output?
I was hoping to get confirmation that the output of my cLox bytecode is correct. I've just finished chapter 17 implementing the pratt parser.
Does this look correct?
(53 * (31 - 13)) + -10 \n 23 / 3== Complex Expression ==
0000 0001 OP_CONSTANT 0 53
0002 | OP_CONSTANT 1 31
0004 | OP_CONSTANT 2 13
0006 | OP_SUBTRACT
0007 | OP_MULTIPLY
0008 | OP_CONSTANT 3 10
0010 | OP_NEGATE
0011 | OP_ADD
0012 | OP_RETURN
0013 0002 OP_CONSTANT 4 23
0015 | OP_CONSTANT 5 3
0017 | OP_DIVIDE
0018 | OP_RETURN
11
Upvotes
View all comments
Show parent comment
2
u/nirlahori Aug 05 '26
I am also reading that book. Currently I have completed till Parsing chapter.