CS451/651 Project 1 (Supporting Simple Operations) Swami IyerObjectives.1. Become familiar with the CLEmitter, an abstraction for generating JVM bytecode (see Appendix D of our text).2. Extend the base j– language by adding some basic Java operations (on primitive integers) to the language. Supportingthese operations requires studying the j– compiler in its entirety, if only cursorily, and then making slight modi cationsto it. Notice that many of the operations have di erent levels of precedence, just as * has a di erent level of precedencein j– than does +. These levels of precedence are captured in the Java grammar (see Appendix C of our text); forexample, the parser uses one method to parse expressions involving * and /, and another to parse expressions involving+ and -.Download and Test the j– Compiler.Download and unzip the base j– compiler under some directory (we’ll refer to this directory as $j). See Appendix A forinformation on what’s in the j– distribution.Run the following command inside the $j directory to compile the j– compiler.$ ant clean compile jarRun the following command to compile a j– program P.java using the j– compiler, which produces the JVM target programP.class.$ sh $j/j –/ bin /j– P. javaRun the following command to run P.class.$ java PProblem 1. (Using CLEmitter) Consider the following program IsPrime.java that receives an integer n as command-lineargument and prints whether or not n is a prime number.// IsPrime . javapublic class IsPrime {// Returns true if n is prime , and false otherwise .private static boolean isPrime (int n) {if (nreturn false ;}for (int i = 2; iif (n % i == 0) {return false ;}}return true ;}// Entry point .public static void main ( String [] args ) {int n = Integer . parseInt ( args [0]);boolean result = isPrime (n);if ( result ) {System . out . println (n + ” is a prime number “);}else {System . out . println (n + ” is not a prime number “);}}}Using programs under $j/j–/tests/clemitter as a guide, complete the implementation of the program GenIsPrime.java thatuses the CLEmitter interface to programmatically generate IsPrime.class, ie, the JVM bytecode for the program IsPrime.javaabove.1 of 3CS451/651 Project 1 (Supporting Simple Operations) Swami Iyer$ javac -cp .: $j/j –/ lib /j –. jar GenIsPrime . java$ java -cp .: $j/j –/ lib /j –. jar GenIsPrime$ java IsPrime 4242 is not a prime number$ java IsPrime 3131 is a prime numberHints: There are two ways to approach this problem, the rst being more intellectually rewarding.1. Use GenFactorial as a model for GenIsPrime. The main() method is almost identical. Here are some hints for generatingbytecode for the isPrime() method:if n >= 2 goto A:return falseA: i = 2D: if i > n / i goto B:if n % i != 0 goto C:return falseC: increment i by 1goto D:B: return True2. Compile IsPrime.java using javac, and decompile (using javap) IsPrime.class to get the bytecode javac generated andmimic the same in GenIsPrime.Problem 2. (Division Operation) Follow the process outlined in Section 1.5 of our text to implement the Java divisionoperator /.$ $j/j –/ bin /j– tests / Division . java$ java Division 42 67Problem 3. (Remainder Operation) Implement the Java remainder operator %.$ $j/j –/ bin /j– tests / Remainder . java$ java Remainder 42 133Problem 4. (Shift Operations) Implement the Java shift operators: arithmetic left shift <<, arithmetic right shift >>, logicalright shift >>>.$ $j/j –/ bin /j– tests / ArithmeticLeftShift . java$ java ArithmeticLeftShift 1 532$ $j/j –/ bin /j– tests / ArithmeticRightShift . java$ java ArithmeticRightShift 32 51$ java ArithmeticRightShift -32 5-1$ $j/j –/ bin /j– tests / LogicalRightShift . java$ java LogicalRightShift 32 51$ java LogicalRightShift -32 5134217727Problem 5. (Bitwise Operations) Implement the Java bitwise operators: unary complement ~, inclusive or |, exclusive or ^,and &. Note: there are JVM instructions for |, ^, and &, but not for ~, which must be computed as the exclusive or” of theoperand and -1.2 of 3CS451/651 Project 1 (Supporting Simple Operations) Swami Iyer$ $j/j –/ bin /j– tests / BitwiseNot . java$ java BitwiseNot 42-43$ $j/j –/ bin /j– tests / BitwiseInclusiveOr . java$ java BitwiseInclusiveOr 3 57$ $j/j –/ bin /j– tests / BitwiseExclusiveOr . java$ java BitwiseExclusiveOr 3 56$ $j/j –/ bin /j– tests / BitwiseAnd . java$ java BitwiseAnd 3 51Problem 6. (Unary Plus Operation) Implement the Java unary plus operaor +.$ $j/j –/ bin /j– tests / UnaryPlus . java$ java UnaryPlus -42-42Files to Submit1. GenIsPrime.java (CLEmitter program that generates IsPrime.class)2. j–.tar.gz (j– source tree as a single gzip le)3. report.txt (project report)Before you submit:Make sure you create the gzip le j–.tar.gz such that it only includes the source les and not the binaries, whichcan be done on the terminal as follows:$ cd $j/j–$ ant clean$ cd ..$ tar -cvf j –. tar j – -/*$ gzip j –. tarMake sure your report uses the given template, isn’t too verbose, doesn’t contain lines that exceed 80 characters,and doesn’t contain spelling mistakes3 of 3