Finish Chapter 14
Implements code chunks, a couple of basic opcodes, constants, and basic execution of those opcodes. Signed-off-by: Daniel Henry <iamdanhenry@gmail.com>
This commit is contained in:
16
src/main.c
Normal file
16
src/main.c
Normal file
@@ -0,0 +1,16 @@
|
||||
#include "chunk.h"
|
||||
#include "common.h"
|
||||
#include "debug.h"
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
Chunk chunk;
|
||||
initChunk(&chunk);
|
||||
int constant = addConstant(&chunk, 1.2);
|
||||
writeChunk(&chunk, OP_CONSTANT, 123);
|
||||
writeChunk(&chunk, constant, 123);
|
||||
writeChunk(&chunk, OP_RETURN, 123);
|
||||
|
||||
disassembleChunk(&chunk, "test chunk");
|
||||
freeChunk(&chunk);
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user