add declarations to translator
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
#include "../translator.h"
|
||||
#include "../../parser/string/string.h"
|
||||
#include "string.h"
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void translate_parsed_string(Translated *translated, ParsedValue *parsedValue) {
|
||||
size_t translate_parsed_string(Translated *translated, ParsedValue *parsedValue) {
|
||||
ParsedString *parsedString = (ParsedString*)parsedValue->data;
|
||||
size_t string_pos = arena_push(&translated->constants, parsedString->string, parsedString->length);
|
||||
set_registers(translated, 1);
|
||||
push_instruction_code(translated, OP_LOAD_CONST);
|
||||
size_t start = push_instruction_code(translated, OP_LOAD_CONST);
|
||||
push_instruction_code(translated, 0);
|
||||
push_instruction_code(translated, OP_TYPE_STRING);
|
||||
push_instruction_code(translated, TYPE_OP_STRING);
|
||||
push_instruction_code(translated,parsedString->length);
|
||||
push_instruction_code(translated, string_pos);
|
||||
fwrite(parsedString->string, 1, parsedString->length, stdout);
|
||||
putchar('\n');
|
||||
return start;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef STRING_H
|
||||
#define STRING_H
|
||||
#ifndef BYTECODE_STRING_H
|
||||
#define BYTECODE_STRING_H
|
||||
#include "../translator.h"
|
||||
|
||||
void translate_parsed_string(Translated * translator, ParsedValue * parsedValue);
|
||||
size_t translate_parsed_string(Translated *translated, ParsedValue *parsedValue);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user