valeri/src/stdlib.hpp

55 lines
965 B
C++

#pragma once
#include <cstdint>
#include "result.hpp"
enum class StdlibFunctionId : uint64_t {
Unknown,
Print,
PrintLn,
Prn,
Slurp,
Spit,
Assert,
Dict,
List,
Array,
Get,
Set,
SrcLoc,
Size,
Map,
Error,
Raise,
Reraise,
Task,
Guard,
Serialize,
Deserialize,
Disassemble,
Max,
};
enum class StdlibTaskId : uint64_t {
Unknown,
Print,
ReadFile,
WriteFile,
Max,
};
class Value;
class Symbol;
class Array;
class StackFrame;
class Continuation;
Result<const char*> get_stdlib_function_name(StdlibFunctionId fun_id);
Result<StdlibFunctionId> get_stdlib_function(const Symbol& name);
Result<StackFrame> call_stdlib_function(StdlibFunctionId fun_id,
const StackFrame& stack);
Result<const char*> get_stdlib_task_name(StdlibTaskId task_id);
Result<StdlibTaskId> get_stdlib_task(const Symbol& name);
Result<Value> call_stdlib_task(StdlibTaskId task_id, const Array& params);