From 6ac2d50fc176b0c77890b6ab6ec4b0db4e4d08a2 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Sat, 19 Sep 2020 21:22:48 +0200 Subject: Still has issues. File "/my/src/tonkadur-python-engine/tonkadur.py", line 266, in run result["content"] = self.compute(instruction['content']) File "/my/src/tonkadur-python-engine/tonkadur.py", line 78, in compute result['content'].append(self.compute(c)) File "/my/src/tonkadur-python-engine/tonkadur.py", line 176, in compute result['content'].append(self.compute(c)) File "/my/src/tonkadur-python-engine/tonkadur.py", line 176, in compute result['content'].append(self.compute(c)) File "/my/src/tonkadur-python-engine/tonkadur.py", line 203, in compute target = target[addr] TypeError: list indices must be integers or slices, not str I assume that somewhere, an address is being used instead of the value. --- .../v1/compiler/fate/v1/ComputationCompiler.java | 5 +++ .../v1/compiler/fate/v1/InstructionCompiler.java | 36 +++++++++++++++++++++- .../tonkadur/wyrd/v1/compiler/util/PopElement.java | 2 +- 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java index 64f7220..25f48e8 100644 --- a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java @@ -1335,6 +1335,9 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor r = reserve(TypeCompiler.compile(compiler, n.get_type())); init_instructions.add(new Initialize(r.get_address())); + + result_as_address = r.get_address(); + result_as_computation = r.get_value(); } @@ -2873,6 +2876,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor throws Throwable { /* TODO */ + System.err.println("[P] Using unimplemented SubListComputation."); } @Override @@ -3085,6 +3089,7 @@ implements tonkadur.fate.v1.lang.meta.ComputationVisitor throws Throwable { /* TODO */ + System.err.println("[P] Using unimplemented SortComputation."); } @Override diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java index 0f23a34..ada630b 100644 --- a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java @@ -635,6 +635,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor throws Throwable { /* TODO */ + System.err.println("[P] Using unimplemented Sort."); } @Override @@ -1050,6 +1051,7 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor throws Throwable { /* TODO */ + System.err.println("[P] Using unimplemented SubList."); } @Override @@ -1127,7 +1129,39 @@ implements tonkadur.fate.v1.lang.meta.InstructionVisitor ) throws Throwable { - /* TODO */ + final ComputationCompiler address_compiler, element_compiler; + + address_compiler = new ComputationCompiler(compiler); + element_compiler = new ComputationCompiler(compiler); + + n.get_collection().get_visited_by(address_compiler); + + if (address_compiler.has_init()) + { + result.add(address_compiler.get_init()); + } + + n.get_storage_pointer().get_visited_by(element_compiler); + + if (element_compiler.has_init()) + { + result.add(element_compiler.get_init()); + } + + result.add + ( + PopElement.generate + ( + compiler.registers(), + compiler.assembler(), + address_compiler.get_address(), + element_compiler.get_computation(), + n.is_from_left() + ) + ); + + address_compiler.release_registers(result); + element_compiler.release_registers(result); } @Override diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/util/PopElement.java b/src/core/src/tonkadur/wyrd/v1/compiler/util/PopElement.java index 9e30aee..3da9a89 100644 --- a/src/core/src/tonkadur/wyrd/v1/compiler/util/PopElement.java +++ b/src/core/src/tonkadur/wyrd/v1/compiler/util/PopElement.java @@ -71,7 +71,7 @@ public class PopElement new RelativeAddress ( collection, - target_index, + new Cast(target_index, Type.STRING), ((PointerType) element_holder.get_type()).get_target_type() ) ) -- cgit v1.2.3-70-g09d2