6#include <unordered_map>
26 static bool saveToFile(
const Bytecode &bytecode,
const std::filesystem::path &filename);
Phasor IR Serializer/Deserializer.
static std::vector< uint8_t > serialize(const Bytecode &bytecode)
Serialize bytecode to Phasor IR format.
static std::string unescapeString(const std::string &str)
Helper to unescape strings from text format.
static const std::unordered_map< OpCode, std::string > opCodeToStringMap
static Bytecode deserialize(const std::vector< uint8_t > &data)
Deserialize Phasor IR format to bytecode.
static const std::unordered_map< std::string, OpCode > stringToOpCodeMap
static OperandType getOperandType(OpCode op, int operandIndex)
static Bytecode loadFromFile(const std::filesystem::path &filename)
Load bytecode from .phir file.
static std::string opCodeToString(OpCode op)
Helper to convert OpCode to string.
static int getOperandCount(OpCode op)
static std::string escapeString(const std::string &str)
Helper to escape strings for text format.
static bool saveToFile(const Bytecode &bytecode, const std::filesystem::path &filename)
Save bytecode to .phir file.
static OpCode stringToOpCode(const std::string &str)
Helper to convert string to OpCode.
The Phasor Programming Language and Runtime.
Complete bytecode structure.