#How To Disassemble NWScript Into Pseudo Code

My Incomplete thoughts on how to decompile NWScript into Pseudo Code

Walk through the instructions as the script would process them.

All code should be grouped into blocks if applicable. 
IF, IF_ELSE, ELSE, BLOCK, etc.

Everything inside a block will be treated as a node, even calls to other blocks (such as methods)

Variables, Methods, Conditions, and Actions are all examples of nodes. pretty much everything is a node.

After the tree has been completely assembled we will need to walk through the tree again and print out the pseudo 
code for all the nodes as they are encountered in the tree.

When a subroutine is encountered it will need to be reconstructed (if it hasn't already been) and 
a reference to it's name returned to the current block with support for arguments.



#Detecting Switch Statements
I believe the best way to check for switch statements is to analyse IF blocks to see if they have
more than one IF branch and that they only have one condition and they are being checked against the same variable

*Example: Good Candidate

  if(var1 == 0){
    //THIS WOULD BE CASE 0:
  }else if(var1 == 1){
    //THIS WOULD BE CASE 1:
  }else{
    //THIS WOULD BE THE DEFAULT CASE IF IT EXISTS
  }

*Example: Bad Candidate

  if(var1 == 0 && var2 < var89){
    //This couldn't be a switch case because it has more than one condition
  }else if(var2 == 1){
    //This would also disqualify the block because it is not checking against the same variable as the first condition
  }else{
    //By this point there is no chance this could ever be a switch statement
  }

#JSR
JSR's are sub routines that can be called at any point during a scripts execution and can also return a single variable



