Parcourir la source

Made help into a proper readme too

master
Ludovic 'Archivist' Lagouardette il y a 1 an
Parent
révision
0329cc5605
2 fichiers modifiés avec 57 ajouts et 14 suppressions
  1. +34
    -0
      README.md
  2. +23
    -14
      src/main.cpp

+ 34
- 0
README.md Voir le fichier

@ -0,0 +1,34 @@
# Sugar
## Commands
lex : string ➔ lexed_output
> takes a filename to a file that must be compiled
merge : lexed_output lexed_output ➔ lexed_output
> merges two lexed modules together
parse : lexed_output ➔ parsed_output
> prepares code for generation
generate : parsed_output string ➔ string
> takes a root filename, it will be appended with ".s" and that will be the generated assembly file,
> the filename will not be consumed
assemble : string ➔ _
> takes a root filename, it will be appended with ".s" and that file will be compiled,
> the compiled output will be the given filename
help : _ ➔ _
> prints this help
## Examples
- compile the file "example.mol" into the "potato.s" assembly file
> `$ sugar example.mol lex parse potato generate`
- compile the file "example.mol" into the "potato" executable
> `$ sugar example.mol lex parse potato generate assemble`
- compile the file "example.mol" and "2.mol" into the "potato" executable
> `$ sugar example.mol lex 2.mol lex merge parse potato generate assemble`

+ 23
- 14
src/main.cpp Voir le fichier

@ -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);
}

Chargement…
Annuler
Enregistrer