#include #include using namespace std; extern string getFileContent(const string& file); extern void setOutputFileContent(const string& language, const string& file, const string& content); extern string parseString(unique_ptr toParse); extern string transpile(const string& toTranspile, string language); int main(int argc, char* argv[]) { string fileName = (argv[argc - 1] != nullptr) ? argv[argc - 1] : "none" ; if (fileName != "none" and fileName.ends_with(".ybcon")) { bool printResult = false; string target = ".lua"; string currentArg; for (int i = 0; i < argc; i++) { currentArg = ((string) argv[i]); if (currentArg == "-printresult") printResult = true; else if (currentArg.starts_with("--target=")) target = '.' + currentArg.erase(0, 9); } const string parsedString = parseString(make_unique(getFileContent(fileName))); const string transpiledString = transpile(parsedString, target); if (printResult) cout << "~~~~[Yerbacon compilation result]~~~~\n\n" << "[WIP]\n" << transpiledString << "\n\n"; setOutputFileContent(target, fileName.erase(fileName.find(".ybcon")) + target, transpiledString); } else cout << "No valid file provided.\n"; return EXIT_SUCCESS; }