|
|
@ -81,22 +81,31 @@ int main(int argc, char** argv) { |
|
|
|
system(link.str().c_str()); |
|
|
|
} else throw std::runtime_error("assemble expects an assembly file"); |
|
|
|
} else if(elem == "help" or elem == "--help") { |
|
|
|
std::cout << "lex : string -> lexed_output\n"; |
|
|
|
std::cout << "merge : lexed_output lexed_output -> lexed_output\n"; |
|
|
|
std::cout << "parse : lexed_output -> parsed_output\n"; |
|
|
|
std::cout << "generate : parsed_output string -> string\n"; |
|
|
|
std::cout << "assemble : string -> \n"; |
|
|
|
std::cout << "help : -> \n"; |
|
|
|
std::cout << "# Sugar\n\n"; |
|
|
|
std::cout << "## Commands\n\n"; |
|
|
|
std::cout << "lex : string ➔ lexed_output\n"; |
|
|
|
std::cout << "> takes a filename to a file that must be compiled\n\n"; |
|
|
|
std::cout << "merge : lexed_output lexed_output ➔ lexed_output\n"; |
|
|
|
std::cout << "> merges two lexed modules together\n\n"; |
|
|
|
std::cout << "parse : lexed_output ➔ parsed_output\n"; |
|
|
|
std::cout << "> prepares code for generation\n\n"; |
|
|
|
std::cout << "generate : parsed_output string ➔ string\n"; |
|
|
|
std::cout << "> takes a root filename, it will be appended with \".s\" and that will be the generated assembly file,\n"; |
|
|
|
std::cout << "> the filename will not be consumed\n\n"; |
|
|
|
std::cout << "assemble : string ➔ _ \n"; |
|
|
|
std::cout << "> takes a root filename, it will be appended with \".s\" and that file will be compiled,\n"; |
|
|
|
std::cout << "> the compiled output will be the given filename\n\n"; |
|
|
|
std::cout << "help : _ ➔ _ \n"; |
|
|
|
std::cout << "> prints this help\n\n"; |
|
|
|
std::cout << "## Examples\n\n"; |
|
|
|
std::cout << "- compile the file \"example.mol\" into the \"potato.s\" assembly file\n"; |
|
|
|
std::cout << "> `$ sugar example.mol lex parse potato generate`\n"; |
|
|
|
std::cout << "\n"; |
|
|
|
std::cout << "examples:\n"; |
|
|
|
std::cout << "\tcompile the file \"example.mol\" into the \"potato.s\" assembly file\n"; |
|
|
|
std::cout << "\t$ sugar example.mol lex parse potato generate\n"; |
|
|
|
std::cout << "- compile the file \"example.mol\" into the \"potato\" executable\n"; |
|
|
|
std::cout << "> `$ sugar example.mol lex parse potato generate assemble`\n"; |
|
|
|
std::cout << "\n"; |
|
|
|
std::cout << "\tcompile the file \"example.mol\" into the \"potato\" executable\n"; |
|
|
|
std::cout << "\t$ sugar example.mol lex parse potato generate assemble\n"; |
|
|
|
std::cout << "\n"; |
|
|
|
std::cout << "\tcompile the file \"example.mol\" and \"2.mol\" into the \"potato\" executable\n"; |
|
|
|
std::cout << "\t$ sugar example.mol lex 2.mol lex merge parse potato generate assemble\n"; |
|
|
|
std::cout << "- compile the file \"example.mol\" and \"2.mol\" into the \"potato\" executable\n"; |
|
|
|
std::cout << "> `$ sugar example.mol lex 2.mol lex merge parse potato generate assemble`\n"; |
|
|
|
} else compile_stack.emplace(elem); |
|
|
|
} |
|
|
|
|
|
|
|