1

Hello i have a question and i hope to find some answers

i want to create a binary tree in pep8 to make some prefix arithmetic

so to do 2+3 the user have to enter + 3 2 to do (3*2)-3 the user have to enter - * 3 2 3

i did it in java and it's :

  class BinaryTree {

    public char opt;//  = {*,+,/,-}
    public int val; 
public char variable ='\0'; 
public boolean feuille = true;
public BinaryTree left;
public BinaryTree right;

  }

other question : i have done all the code in java , can i see the assembly code of my java programm? so after that i will create a pep8 programm using the assembly code

saidmohamed11
  • 275
  • 5
  • 15
  • pep8 seems to be a coding style guide for python, but you're asking about assembly, did you mean pdp 8? – harold Nov 30 '14 at 12:54
  • Java is typically compiled into _bytecode_. At runtime, the Java Virtual Machine can interpret the bytecode, or translate it into machine code for your target machine using Just In Time compilation. – Michael Nov 30 '14 at 12:55
  • @harold ........https://code.google.com/p/pep8-1/ ......it's : Pep/8 Assembler and Simulator ... – saidmohamed11 Nov 30 '14 at 12:57
  • @Michael i understand that but i dont know how to see the assembly code ! – saidmohamed11 Nov 30 '14 at 13:13
  • Ok, I don't know if there is a tag for that, but [tag:pep8] isn't it (though it has been used that way in the past) – harold Nov 30 '14 at 13:25
  • If you managed to write it in java, you already know the logic. It should be a simple matter to rewrite in pep8, instead of trying to get java bytecode and somehow translate that. – Jester Nov 30 '14 at 13:35
  • @Jester yes, but the only problem is that i dont know how to handle binary tree in assembly (googling dont give me some good stuff !!!) – saidmohamed11 Nov 30 '14 at 13:37
  • If you understand what a binary tree is, what is your problem? Try to ask a specific question. – Jester Nov 30 '14 at 13:43
  • I suppose you have read _Computer Systems_ by Stanley Warford? There's sample code for a linked list in section 6.5. Your binary tree is not so different; there are a few more fields in the node structure, and you need recursion (section 2.4) to traverse the tree. Like Jester said, you worked out the algorithm in Java, it should not be too hard to put all the pieces together. As for your second question, porting assembly from one processor architecture to another is harder than writing assembly from scratch; this was the main reason why K&R developed the C programming language, or so I'm told. – Ruud Helderman Nov 30 '14 at 23:24

0 Answers0