Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment specification Your job is to count the number of identifiers in programs written in our Tiny language. You should pick out the identifiers from

image text in transcribed

Assignment specification Your job is to count the number of identifiers in programs written in our Tiny language. You should pick out the identifiers from a text file, and write the output to a text file (named A1.output). Note that the output file should contain a line like "identifiers:5". Here are the sample input and output files. The input will have multiple lines. Please note that in this sample program the following are not counted as identifiers: A41, input, output: they are quoted hence they are not treated as identifiers; INT, READ etc.: They are keywords used in our Tiny language hence they should not be picked up. Here are the test cases for the assignment: case 1, case 2, case 3, case 4, case 5, case 6. (ID counts: 5 4 6 7 8 9). If you can not pass test case 6, and you use [a-zA-Z] as delimiter in Scanner, you can solve the problem by specifying the encoding as UTF-8, i.e., use new Scanner (yourFile, "UTF-8").... In this assignment you can suppose that there are no comments in the programs. In the output file you should only write "identifiers:" followed by the number of identifiers. If there are multiple occurrences of an identifier in the input, you should only count it once. Don't write anything else into the output file. You will write two different programs to do this: 1. Program A11.java is not supposed to use regular expressions, not regex package, not the methods involvoing regular expression in String class or other classes. Your program can look at characters one by one, and write a loop to check whether they are quoted strings, identifiers, etc.' Assignment specification Your job is to count the number of identifiers in programs written in our Tiny language. You should pick out the identifiers from a text file, and write the output to a text file (named A1.output). Note that the output file should contain a line like "identifiers:5". Here are the sample input and output files. The input will have multiple lines. Please note that in this sample program the following are not counted as identifiers: A41, input, output: they are quoted hence they are not treated as identifiers; INT, READ etc.: They are keywords used in our Tiny language hence they should not be picked up. Here are the test cases for the assignment: case 1, case 2, case 3, case 4, case 5, case 6. (ID counts: 5 4 6 7 8 9). If you can not pass test case 6, and you use [a-zA-Z] as delimiter in Scanner, you can solve the problem by specifying the encoding as UTF-8, i.e., use new Scanner (yourFile, "UTF-8").... In this assignment you can suppose that there are no comments in the programs. In the output file you should only write "identifiers:" followed by the number of identifiers. If there are multiple occurrences of an identifier in the input, you should only count it once. Don't write anything else into the output file. You will write two different programs to do this: 1. Program A11.java is not supposed to use regular expressions, not regex package, not the methods involvoing regular expression in String class or other classes. Your program can look at characters one by one, and write a loop to check whether they are quoted strings, identifiers, etc

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

Advances In Databases 11th British National Conference On Databases Bncod 11 Keele Uk July 7 9 1993 Proceedings Lncs 696

Authors: Michael F. Worboys ,Anna F. Grundy

1993rd Edition

3540569219, 978-3540569213

More Books

Students also viewed these Databases questions

Question

what are emerging technologies?

Answered: 1 week ago

Question

1. Outline the listening process and styles of listening

Answered: 1 week ago

Question

4. Explain key barriers to competent intercultural communication

Answered: 1 week ago