23 std::println(
"Phasor Decompiler\nCopyright (c) 2026 Daniel McGuire");
32 if (!
m_args.silent) std::println(
"Success! Output to {}",
m_args.outputFile.string());
35 std::println(std::cerr,
"Failed to disassemble program!");
42 m_args.program = std::filesystem::path(argv[0]);
43 for (
int i = 1; i < argc; i++)
45 std::string arg = argv[i];
47 if (arg ==
"-h" || arg ==
"--help")
52 else if (arg ==
"-o" || arg ==
"--output")
56 m_args.outputFile = argv[++i];
60 std::println(std::cerr,
"Error: {} requires an argument", arg);
65 else if (arg ==
"-n" || arg ==
"--nologo")
69 if (arg ==
"-s" || arg ==
"--silent")
74 else if (arg[0] ==
'-')
76 std::println(std::cerr,
"Error: Unknown option: {}", arg);
82 if (
m_args.inputFile.empty())
86 std::println(std::cerr,
"Error: Multiple input files specified");
97 std::println(
"Usage:\n"
98 " {} [options] <input.phsb>"
100 " -o, --output <file> Output file"
101 " -h, --help Show this help message"
102 " -n, --nologo Do not show banner"
103 " -s, --silent Do not print anything except errors (no stdout)",
m_args.program.stem().string());
111 if (
m_args.outputFile.empty())
114 std::filesystem::path path(
m_args.outputFile);
115 path.replace_extension(
".phir");
116 m_args.outputFile = path.string();
Bytecode binary format deserializer.
Bytecode loadFromFile(const std::filesystem::path &filename)
Load bytecode from .phsb file.
struct Phasor::Disassembler::Args m_args
bool parseArguments(int argc, char *argv[])
Disassembler(int argc, char *argv[])
Phasor IR Serializer/Deserializer.
static bool saveToFile(const Bytecode &bytecode, const std::filesystem::path &filename)
Save bytecode to .phir file.
The Phasor Programming Language and Runtime.