static void Main(string[] args) { if (args.Any()) { var fileName = args[0]; var infix = ReadInfixFromFile(fileName); if (infix == null) { Console.WriteLine("The file content could not be read. Program exiting..."); return; } var postfix = PostfixFromFile(infix); var converter = new FasmConverter(postfix); // FASM / A86 var asm = converter.ToAsm(); var asmFileName = Path.GetFileNameWithoutExtension(fileName) + ".asm"; SaveAsmFile(asm, asmFileName); } else { Console.WriteLine("You must provide a file name. Program exiting..."); } // Uncomment the below code to run the program in Visual Studio. //RunFasmFromFile(); //RunMultiOptional(); }
private static void RunFasmFromFile() { var infix = ReadInfixFromFile(); var postfix = PostfixFromFile(infix); var converter = new FasmConverter(postfix); var asm = converter.ToAsm(); var asmFileName = Path.GetFileNameWithoutExtension(_filePath) + "fasm.asm"; SaveAsmFile(asm, asmFileName); }
private static void RunFasmFromConsole() { var postfix = PostfixFromConsole(); var converter = new FasmConverter(postfix); if (!converter.IsValid) { Console.WriteLine("Postfix expression has invalid tokens: " + string.Join(", ", converter.InvalidTokens)); Console.WriteLine("Press enter to exit"); Console.ReadLine(); } else { var asm = converter.ToAsm(); var asmFileName = "consoleinputfasm.asm"; SaveAsmFile(asm, asmFileName); } }