Added support for GenericPrint opcode
This commit is contained in:
parent
ff0ae8fcba
commit
67b44dbfc9
|
@ -470,6 +470,8 @@ proc dispatch*(self: PeonVM) =
|
|||
discard self.pop()
|
||||
continue
|
||||
echo self.pop()
|
||||
of GenericPrint:
|
||||
echo self.pop()
|
||||
of PopN:
|
||||
# Pops N elements off the call stack
|
||||
for _ in 0..<int(self.readShort()):
|
||||
|
|
|
@ -896,6 +896,8 @@ proc handleBuiltinFunction(self: Compiler, fn: Name, args: seq[Expression]) =
|
|||
elif len(args) == 1:
|
||||
self.expression(args[0])
|
||||
case fn.valueType.builtinOp:
|
||||
of "GenericPrint":
|
||||
self.emitByte(GenericPrint)
|
||||
of "AddInt64":
|
||||
self.emitByte(AddInt64)
|
||||
of "SubInt64":
|
||||
|
|
|
@ -90,6 +90,7 @@ type
|
|||
LoadNan,
|
||||
LoadInf,
|
||||
## Operations on primitive types
|
||||
GenericPrint,
|
||||
NegInt64, # No unsigned variants (how would you negate something that has no sign?)
|
||||
NegInt32,
|
||||
NegInt16,
|
||||
|
@ -199,7 +200,7 @@ const simpleInstructions* = {Return, LoadNil,
|
|||
SubFloat64, DivFloat64, MulFloat64,
|
||||
AddFloat32, SubFloat32, DivFloat32,
|
||||
MulFloat32, NegFloat32, NegFloat64,
|
||||
LessThanInt64, SysClock64
|
||||
LessThanInt64, SysClock64, GenericPrint,
|
||||
}
|
||||
|
||||
# Constant instructions are instructions that operate on the bytecode constant table
|
||||
|
|
|
@ -193,7 +193,7 @@ proc runFile(f: string, interactive: bool = false, fromString: bool = false) =
|
|||
serialized: Serialized
|
||||
tokenizer = newLexer()
|
||||
parser = newParser()
|
||||
compiler = newCompiler(replMode=true)
|
||||
compiler = newCompiler()
|
||||
debugger {.used.} = newDebugger()
|
||||
serializer = newSerializer()
|
||||
vm = newPeonVM()
|
||||
|
|
Loading…
Reference in New Issue