(Solved) : Parsing C Programs Create Perl Script Called Cparsepl Counts Tokens C Program Name Program Q27545990 . . .
Parsing C Programs
Create a perl script called cparse.pl that counts tokens in a Cprogram. The name of the
program (file) shall be specified via the command line. Thus, theprogram should be invoked
from the command line via:
perl cparse.pl mainProg.c
For each line of the C program cparse.pl should output:
1. The number of words (variable and reserved) on the line.
2. The number of numeric literals without decimal points on theline.
3. The number of numeric literals with decimal points on theline.
4. The number of braces, brackets and parentheses on theline.
Finally, the script should output the total number of each of thefour classes, above, that were in
the entire program.
Here is what the end of output might look like:
Words: 8 Ints: 1 Floats: 2 Braces: 4
Words: 3 Ints: 0 Floats: 0 Braces: 2
================================================
TOTALS:
Words: 435 Ints: 23 Floats: 8 Braces: 64
Expert Answer
Answer to Parsing C Programs Create Perl Script Called Cparsepl Counts Tokens C Program Name Program Q27545990 . . .
OR