~madcapjake/rhi

2d5f97f1fa2ef2dc74b6348f7364b37d8eb8f048 — Jake Russo 1 year, 5 months ago c9a4c63
REPL now prints last value
2 files changed, 6 insertions(+), 5 deletions(-)

M internal/cli/cli.go
M internal/vm/chunk.go
M internal/cli/cli.go => internal/cli/cli.go +1 -0
@@ 110,6 110,7 @@ func ReadEvalPrintLoop(ctx context.Context, args []string) error {
			fmt.Fprintf(os.Stderr, "ERROR: %s\n", err)
			os.Exit(1)
		}
		ctx = context.WithValue(ctx, LastValueCK, true)
		interpretMany(ctx, []string{text})
	}
}

M internal/vm/chunk.go => internal/vm/chunk.go +5 -5
@@ 139,23 139,23 @@ func (ch RhumbChunk) execTagIndex(vm *VirtualMachine, tag byte, idx int) {
	switch tag {
	case TAG_VALUE_LITERAL:
		lit = literals.Get(vm, idx)
		fmt.Println("Executing literal tag:", lit.Debug())
		// fmt.Println("Executing literal tag:", lit.Debug())
		vm.AddLiteralToStack(lit)
	case TAG_LOCAL_REQUEST:
		lit = literals.Get(vm, idx)
		fmt.Println("Executing local tag:", lit.Debug())
		// fmt.Println("Executing local tag:", lit.Debug())
		vm.SubmitLocalRequest(lit)
	case TAG_INNER_REQUEST:
		lit = literals.Get(vm, idx)
		fmt.Println("Executing inner tag:", lit.Debug())
		// fmt.Println("Executing inner tag:", lit.Debug())
		vm.SubmitInnerRequest(lit)
	case TAG_UNDER_REQUEST:
		lit = literals.Get(vm, idx)
		// lit = literals.Get(vm, idx)
		fmt.Println("Executing under tag:", lit.Debug())
		vm.SubmitUnderRequest(lit)
	case TAG_OUTER_REQUEST:
		lit = literals.Get(vm, idx)
		fmt.Println("Executing outer tag:", lit.Debug())
		// fmt.Println("Executing outer tag:", lit.Debug())
		vm.SubmitOuterRequest(lit)
	// case TAG_EVENT_REQUEST:
	// 	vm.SubmitEventRequest(literals.Get(idx))