From 47dcc24e1e0601dd12f0ac44d85510c3885a9e16 Mon Sep 17 00:00:00 2001 From: Qrakhen Date: Fri, 7 Nov 2025 14:56:24 +0100 Subject: [PATCH] add small todolist for me --- Qrakhen.Qamp.Core/Execution/Runner.cs | 29 +++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/Qrakhen.Qamp.Core/Execution/Runner.cs b/Qrakhen.Qamp.Core/Execution/Runner.cs index 66e1909..580c786 100644 --- a/Qrakhen.Qamp.Core/Execution/Runner.cs +++ b/Qrakhen.Qamp.Core/Execution/Runner.cs @@ -10,6 +10,21 @@ namespace Qrakhen.Qamp.Core.Execution; using Op = OpCode; +/* + * Todo: + * - Make Digester OOP-ish + * - inherit from a base digester that has the continouus stack / reader references as protected information + * - one digester for every job area (Loops, Functions, Variables, etc.) + * - time is not as essential here as I want to have the executables pre-compiled to OpCodes anyway + * - Think of a cleaner way to handle Obj (Pointers specifically) + * - Finish runner + * - add interpretation for all remaining op codes + * - make variable operations faster with optimized inline lambda expressions + * - better debugging for the instruction set + * - Add classic sqript dialect + * - Fix console "IDE" + */ + /// /// Dynamic Pointer able to point to any object implementing the interface. /// @@ -83,16 +98,18 @@ public class InstructionPtr : Pointer } - public String? GetString(long offset) + public String? GetStringConstant(long offset) { return Segment.Constants[offset].Ptr.Value as String; } public Instruction Instruction => Segment.Instructions[Ptr]; - public static Instruction operator +(InstructionPtr ptr, int value) => ptr.Segment.Instructions[ptr.Ptr + value]; + public static Instruction operator +(InstructionPtr ptr, int value) + => ptr.Segment.Instructions[ptr.Ptr + value]; - public static Instruction operator -(InstructionPtr ptr, int value) => ptr.Segment.Instructions[ptr.Ptr - value]; + public static Instruction operator -(InstructionPtr ptr, int value) + => ptr.Segment.Instructions[ptr.Ptr - value]; public static InstructionPtr operator ++(InstructionPtr ptr) { @@ -203,7 +220,7 @@ public class Runner : IDisposable } case Op.DefineGlobal: { - string? name = call.Instruction.GetString(call.Instruction.NextDynamic())?.Value; + string? name = call.Instruction.GetStringConstant(call.Instruction.NextDynamic())?.Value; if (string.IsNullOrEmpty(name)) throw new ExecutionException($"tried to define global variable with empty name"); Globals[name] = Pop(); @@ -212,7 +229,7 @@ public class Runner : IDisposable } case Op.SetGlobal: { - string? name = call.Instruction.GetString(call.Instruction.NextDynamic())?.Value; + string? name = call.Instruction.GetStringConstant(call.Instruction.NextDynamic())?.Value; if (string.IsNullOrEmpty(name)) throw new ExecutionException($"tried to set global variable with empty name"); if (!Globals.Has(name)) @@ -223,7 +240,7 @@ public class Runner : IDisposable } case Op.GetGlobal: { - string? name = call.Instruction.GetString(call.Instruction.NextDynamic())?.Value; + string? name = call.Instruction.GetStringConstant(call.Instruction.NextDynamic())?.Value; if (string.IsNullOrEmpty(name)) throw new ExecutionException($"tried to set global variable with empty name"); if (!Globals.Has(name))