rintolang / rinto

In-development open source programming language based on C/C++
https://rintolang.github.io
GNU General Public License v3.0
3 stars 2 forks source link

CMD package #5

Open zeim839 opened 2 years ago

zeim839 commented 2 years ago

The CMD utility should work like so:

rinto [Parameter=[Value], Flag] [file.rin]+

Parameters are flags that take values, and [file.rin]+ is any number of .rin source files.

The help section should then be:

Usage:
 rinto [Parameter=[Value], Flag] [file.rin]+

The commands are:
 [Flag] \t Name : Help

@rohan221102

rohan221102 commented 2 years ago

Adding the target [x86, x64, ARM] logic as well!

rohan221102 commented 2 years ago
image
zeim839 commented 2 years ago

x86, ARM, etc. are not parameters, they are values. Parameters refer to flags that take input, so If we for example have:

rinto --target=x86

Then --target is the parameter and x86 is the value.

Here's what should be done to clear up any confusion:

  1. Insert a target parameter in the list of commands followed by square brackets as placeholders for the target value. See below:
    The commands are:
    ...
    [-t or --target]=[target]       Target specifies the file's compilation target architecture. 
  2. Rename the parameter section to target section, like so (make sure each target is separated by a tab instead of a whole new line, no point wasting space here):
    Target: (in place of 'the parameters are...')
    x86-32    x86-64    ARM    ARM-64    RISC-V

    This should make usage of the --target command more intuitive for the user. Also, from now on, you can assume that none of the other flags (-S, -h, -v) take any values. If the user was to use -S with a specific target, they will have to use the --target parameter also.

rohan221102 commented 2 years ago
image

Updated the targets, and added the new targets, let me know if you want me to update the formatting used for the targets.

zeim839 commented 2 years ago

Put all the targets into one line please. So instead of doing:

for(int a = 0; a < sizeof(targ)/sizeof(targ[0]); a++)
    std::cout << "\t" << targ[a].type << std::endl;

Do:

for(int a = 0; a < sizeof(targ)/sizeof(targ[0]); a++)
    std::cout << "\t" << targ[a].type;

See here
Also, all functions should open curly braces on a new line (as per CONTRIBUTING.md):

// Incorrect:
void initFlags {
    // ...
}
// Correct:
void initFlags
{
    // ...
}
// Also correct:
for (int i = 0; i<5; i++) {
   // Opening braces in new lines is for functions only
}

Braces on a new line are strictly for functions only. Everything else should open on the same line.