3. (a) Four phases of a compiler, in alphabetical order, are: intermediate code generation lexical analysis machine code

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

3. (a) Four phases of a compiler, in alphabetical order, are: intermediate code generation lexical analysis machine code

Post by answerhappygod »

3 A Four Phases Of A Compiler In Alphabetical Order Are Intermediate Code Generation Lexical Analysis Machine Code 1
3 A Four Phases Of A Compiler In Alphabetical Order Are Intermediate Code Generation Lexical Analysis Machine Code 1 (41.16 KiB) Viewed 23 times
3. (a) Four phases of a compiler, in alphabetical order, are: intermediate code generation lexical analysis machine code generation syntax analysis State the input and output of each phase. (Hint: Considering that a compiler translates program source code into machine code, the input to the first phase will be program source code and the output from the last phase will be machine code.) (8 marks) (b) Here is some intermediate code generated by a compiler for part of program written in Java: labell: rl = v10 < 100 if (rl = 0) jmp label2 r2 = v10 * 3 r3 = r2+1 v10=13 jmp labell label2: Suggest what the original Java source code might have been (6 marks) (c) Consider the following Java source code, where x is a local variable of type int and f() is a function that takes an int and returns an int: if(x=2) { x=f(0); } else { x= 1; } Translate the Java source code into intermediate code. You may wish to use comments to make the meaning of your intermediate code instructions clear.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply