Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Parsing C Programs Create a perl script called cparse.pl that counts tokens in a C program. The name of the program (file) shall be specified

Parsing C Programs Create a perl script called cparse.pl that counts tokens in a C program. The name of the program (file) shall be specified via the command line. Thus, the program 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 the line. 3. The number of numeric literals with decimal points on the line. 4. The number of braces, brackets and parentheses on the line. Finally, the script should output the total number of each of the four 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman

13th Edition

0134773659, 978-0134773650

More Books

Students also viewed these Databases questions

Question

Understand why customers are loyal to a particular service firm.

Answered: 1 week ago