Minor documentation additions
This commit is contained in:
parent
da651355b9
commit
f50dd66741
|
@ -465,11 +465,16 @@ proc dispatch*(self: PeonVM) =
|
|||
# onto the call stack
|
||||
self.pushc(self.pop())
|
||||
of PopRepl:
|
||||
# Pops a peon object off the
|
||||
# operand stack and prints it.
|
||||
# Used in interactive REPL mode
|
||||
if self.frames.len() > 1:
|
||||
discard self.pop()
|
||||
continue
|
||||
echo self.pop()
|
||||
of GenericPrint:
|
||||
# Prints the peon object at the top
|
||||
# of the operand stack
|
||||
echo self.pop()
|
||||
of PopN:
|
||||
# Pops N elements off the call stack
|
||||
|
@ -499,7 +504,6 @@ proc dispatch*(self: PeonVM) =
|
|||
else:
|
||||
discard self.pop()
|
||||
# Built-in operations on primitive types
|
||||
# Note how
|
||||
of AddInt64:
|
||||
self.push(PeonObject(kind: Int64, long: self.pop().long + self.pop().long))
|
||||
of SubInt64:
|
||||
|
@ -595,6 +599,11 @@ proc dispatch*(self: PeonVM) =
|
|||
of LessThanInt64:
|
||||
self.push(PeonObject(kind: Bool, boolean: self.pop().long < self.pop().long))
|
||||
of SysClock64:
|
||||
# Pushes the value of a monotonic clock
|
||||
# as a 64 bit float onto the operand stack.
|
||||
# Used to track system runtime accurately,
|
||||
# but cannot be converted to a date. The number
|
||||
# is in seconds
|
||||
self.push(PeonObject(kind: Float64, `float`: getMonoTime().ticks().float() / 1_000_000_000))
|
||||
else:
|
||||
discard
|
||||
|
|
|
@ -3,6 +3,11 @@ operator `+`(a, b: int): int {
|
|||
}
|
||||
|
||||
|
||||
fn print(x: int) {
|
||||
#pragma[magic: "GenericPrint"]
|
||||
}
|
||||
|
||||
|
||||
fn getAdder(a, b: int): fn: int64 {
|
||||
var x = a;
|
||||
var y = b;
|
||||
|
@ -13,7 +18,7 @@ fn getAdder(a, b: int): fn: int64 {
|
|||
}
|
||||
|
||||
|
||||
var a = 5;
|
||||
var b = 6;
|
||||
var a = 1;
|
||||
var b = 2;
|
||||
var adder = getAdder(a, b);
|
||||
adder();
|
||||
print(adder());
|
||||
|
|
Loading…
Reference in New Issue