| summaryrefslogtreecommitdiff |
path: root/tonkadur.py
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-08-08 18:24:29 +0200 |
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2020-08-08 18:24:29 +0200 |
| commit | 528ca6510a13d58b1a9fd1a8e82c2633ddd470b5 (patch) | |
| tree | ce9dff3e4826d1f8c70bef78a8c07ba78b3d588f /tonkadur.py | |
| parent | 0516f764c1fcffe40417c9b67e500febd831afe5 (diff) | |
Fixes issues with references handling.
Diffstat (limited to 'tonkadur.py')
| -rw-r--r-- | tonkadur.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tonkadur.py b/tonkadur.py index d4b2e73..0870e76 100644 --- a/tonkadur.py +++ b/tonkadur.py @@ -119,7 +119,7 @@ class Tonkadur: else: return self.compute(computation['if_false']) elif (computation_category == "new"): - address = ".alloc." + self.allocated_data + address = ".alloc." + str(self.allocated_data) self.allocated_data += 1 self.memory[address] = self.generate_instance_of(computation['target']) @@ -157,7 +157,11 @@ class Tonkadur: print("unknown operator " + operator) elif (computation_category == "ref"): - return [self.compute(computation['address'])] + result = self.compute(computation['address']) + if (isinstance(result, list)): + return result + else: + return [result] elif (computation_category == "relative_ref"): base = self.compute(computation['base']) base.append(self.compute(computation['extra'])) @@ -181,7 +185,7 @@ class Tonkadur: elif (computation_category == "value_of"): target = self.memory access = self.compute(computation['reference']) - + #print("Reading: " + str(access)) for addr in access: target = target[addr] @@ -268,7 +272,9 @@ class Tonkadur: pre_val = self.memory current_val = pre_val last_access = "" + #print("Reference:" + str(instruction["reference"])) access_full = self.compute(instruction["reference"]) + #print("Writing: " + str(access_full)) for access in access_full: pre_val = current_val |


