Starting from:
$29.99

$23.99

Homework #4 Solution

W r i t e a p r o g r a m t h a t c o n v e r t s e x p r e s s i o n s t o a s s e m b l y l a n g u a g e . Y o u h a v e a n i n p u t f i l e t h a t i n c l u d e s e x p r e s s i o n l i n e s . S o y o u w i l l c o n v e r t t h e f i l e t o a n a s s e m b l y f i l e u s i n g j a v a d a t a s t r u c t u r e s .

 

Spesific Restrictions:

 

-Convert the infix expressions to postfix form.

 

-After getting postfix expressions, you should convert each operation to assembly instructions and registers.

 

-After all conversion you should save your assembly code to .asm file. You can test your code in mars editor.

 

-You should also check some unconditional situations (such as, undefined variable usage,division by zero, uncompitable type, out of register limit..).

 

-You should use only java list and stack and also you can create your data structures.

 

-You should use only these registers : [$t0-$t8,$a0,$v1] and instructions in table below . Expression Spesifics:

- E x p r e s s i o n v a r i a b l e t y p e i s i n t e g e r .

 

- T h e r e a r e 5 o p e r a t o r s ( + , - , * , / , = ) a n d p r i n t f u n c t i o n .

You can directly use this assembly patches by tracking registers:

 

Expression               Assembly code

a b +        add $t3,$t2,$t1                                             #a in t1,b in t2

2 a +        li $t2,2

 

add $t3,$t2,$t1                                             #a in t1

2 a -         li $t1,2

 

sub $t3,$t2,$t1

b a *        mult $t1,$t2

 

mflo $t3                                                           #get res from mflo

a 3 /        li               $t3,3

 

div            $t1,$t3 mfhi $t3

print c      move $a0, $t3                                                  # print c,c in t3 li $v0, 1 #print_in

syscall

 

available instruction table for homework

 

Name     Usage     syntax

Load immediate  li $t,c      $t = C (signed)

Move     move $t,$s            $t = $s

 

Add        add $d,$s,$t                          $d = $s + $t          

 

                Subtract                 sub $d,$s,$t                          $d = $s - $t           

 

                Multiply                 mult $s,$t                              LO = (($s * $t) << 32) 32;            

                HI = ($s * $t) 32;          

 

                Divide                    div $s, $t                                LO = $s / $t     HI = $s % $t              

 

Print        la $a0,$t                li $t3, 1  

                                move $a0, $t3      # print t3.

                               

li $v0, 1 

# syscall 1 = print_in

                                syscall    # do the syscall

OBJECTIVES:

 

-       Preparing object oriented design for the problem

-       Applying error handling

-       Applying inheritance

-       Applying code documentation

-       Applying clean code standards

-       Creating javadoc documentation

 

RESTRICTIONS:

 

-       Use maven standard Project template

-       Use only ArrayList data structure

-       Can be only one main class in project

-       Don’t use any other third part library

 

GENERAL RULES:

 

-       For any question firstly use course news forum in moodle, and then the contact TA.

-       Use  maven project management tool. And upload maven project into moodle.

-       Code the Project in Java programming language. Java must be 1.8.* or bigger version.

-       Any java IDE can be used in coding process.

-       Implement all interfaces class

-       Add  all  javadoc  documentations  for  classes,  methods,  variables  …etc.  All  explanation  must  be  meaningful  and

understandable.

-        Implement clean code standarts in your code;

o  Classes, methods and variables names must be meaningful and related with the functionality.

o  Your functions and classes must be simple, general, reusable and focus on one topic.

o  Use standart java code name conventions.

-       Register github student pack and create private project and upload your projects into github.

-       Your appeals are considered over your github project process.

-       You can submitting assignment one day late and will be evaluated over forty percent (%40).

-       Create report which include;

o  Your name, surname, studentid

o  Detailed system requirements

o  The Project usecase diagrams (extra points)

o  Class diagrams

o  Problem solutions approach

o  Test cases

o  Running command and results

 

GRADING :

 

-       No OOP design                                           : -100

-       No maven Project                                      : -100

-       No error handling                                      : -95

-       No javadoc documentation                      : -95

-       No clean code standard                            : -95

-       No report                                                     : -90

-       Disobey restrictions                                   : -98

-   Your solution is evaluated over 100 as your performance. Don’t forget this is performance project.

More products