toylang
Version:
A toy programming language built with TypeScript for learning purposes
34 lines (33 loc) • 951 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.stdlib = void 0;
var CallableFunction_1 = require("./CallableFunction");
exports.stdlib = {
time: CallableFunction_1.CallableFunction.new({
arity: 0,
call: function () {
return +new Date() / 1000.0;
},
toString: function () {
return "<native fn>";
},
}),
mod: CallableFunction_1.CallableFunction.new({
arity: 2,
call: function (_, args) {
return args[0] % args[1];
},
toString: function () {
return "<native fn>";
},
}),
print: CallableFunction_1.CallableFunction.new({
arity: Infinity,
call: function (interpreter, args) {
console.log.apply(console, args);
},
toString: function () {
return "<native fn>";
},
}),
};