2021-05-11 06:55:13 +00:00
|
|
|
local Dict = require("Dictionary")
|
|
|
|
local Stack = require("Stack")
|
|
|
|
|
2021-05-11 06:58:09 +00:00
|
|
|
function add(stack: Stack)
|
|
|
|
local a: any =stack:pop()
|
|
|
|
local b: any=stack:pop()
|
|
|
|
if a is number and b is number then
|
|
|
|
local c=a+b
|
|
|
|
stack:push(c)
|
|
|
|
else
|
|
|
|
error("invalid operands for add operation!")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
function dot(s: Stack)
|
|
|
|
print(s:pop())
|
|
|
|
end
|
2021-05-11 06:55:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|