write bytecode debugging script and start working on functions
This commit is contained in:
@@ -5,14 +5,13 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
size_t translate_parsed_number(Translated *translated, ParsedValue *parsedValue) {
|
||||
char *number_str = (char*)parsedValue->data;
|
||||
size_t translate_parsed_number(Translated *translated, char *number_str, size_t to_register) {
|
||||
size_t length = strlen(number_str);
|
||||
size_t number_pos = arena_push(&translated->constants, number_str, length);
|
||||
set_registers(translated, 1);
|
||||
set_registers(translated, to_register+1);
|
||||
|
||||
size_t start = push_instruction_code(translated, OP_LOAD_CONST);
|
||||
push_instruction_code(translated, 0);
|
||||
push_instruction_code(translated, to_register);
|
||||
|
||||
push_instruction_code(translated, TYPE_OP_NUMBER);
|
||||
push_instruction_code(translated,length);
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
#define BYTECODE_NUMBER_H
|
||||
#include "../translator.h"
|
||||
|
||||
size_t translate_parsed_number(Translated *translated, ParsedValue *parsedValue);
|
||||
size_t translate_parsed_number(Translated *translated, char *number_str, size_t to_register);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user