subject

In most programming languages, the compiler carries a preprocessing step to determine if certain statements will compile. for instance it may check to see if parentheses match. write a java program that simulates the actions of a preprocessor, to detect if certain java constructs are syntactically correct. table 1 shows the types of java statement formats under consideration, and also example of each statement. table 1 format examplestatement data_type = expression int x = 3 + (10 – 4) * ( 10 + 4)method rt name() public void display(int n) { { int arr[ ] = new int[n]; } system. out. println( x[2] ); }class class name public class myparser { { dt fields; public static void main(string [ ] arg) name() { { display (10); method(); } } static void display(int x) { { /* } my pre-processor */ } }table 2 shows the delimiters under consideration. table 2 delimiters symbol left parenthesis ( right parenthesis ) left curly braces { right curly braces } left square brackets [ right square brackets ] forward slash / star (multiplication symbol) *note: in your implementation, design a class called preprocessor that accepts a file that represents the program to be analyzed. the class will contain, among other possible methods, a method that determines whether or not the statement in the file are valid, with respect to the delimiters of table 2. do not be concerned with other symbols.1. you will need a test class. you may want to name it mypreprocessor.2. you may have to enter all statements on a single line, unless you will be reading the input from a file, in which case the file would be read using presumable the class bufferedreader or linenumberreader.3. your output would echo the input, and say whether or not the input passed the preprocessing stage.4. you are to use the concept of stack to determine if the constructs are syntactically correct.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
What is added to the < meta > tag to describe the encoding type?
Answers: 2
question
Computers and Technology, 24.06.2019 21:00
How does a vaccine prevent sickness and individual?
Answers: 2
question
Computers and Technology, 24.06.2019 22:30
To include a watermark or page border on a word document, you will first need to navigate to the tab. file home insert design
Answers: 1
question
Computers and Technology, 25.06.2019 05:10
Create a console project in c#. 1. create an interface "imyinterface.cs" - add a method "string imessage()" 2. create a class named "c1.cs" - add 4 private data members, create property for each data member double loanamnout=0.0; double years=0.0; double interests=0.0; double interestrate=0.0; 3. - add a constructor with parameters to assign values to loanamnout, years, interestrate with values that user entered. 4. - add one method “payinterests()” to return the interests interests = loanamnout * interestrate * years 5. - inheritate "imyinterface", implement the method " imessage()", return string "be ready! ” 6. in program.cs, have users to enter loanamnout, years, interestrate. - call method payinterests() to display total interests. - call imessage() to display "be ready! ”
Answers: 3
You know the right answer?
In most programming languages, the compiler carries a preprocessing step to determine if certain sta...
Questions
question
Mathematics, 16.04.2020 02:32
Questions on the website: 13722363