2020-09-13 21:32:55 -04:00
|
|
|
#pragma once
|
|
|
|
|
2020-10-29 21:27:52 -04:00
|
|
|
#include <functional>
|
2020-11-20 20:17:37 -05:00
|
|
|
#include <optional>
|
2021-07-15 21:37:15 -04:00
|
|
|
|
|
|
|
#include "third-party/fmt/color.h"
|
|
|
|
#include "third-party/fmt/core.h"
|
|
|
|
|
2020-09-17 21:47:52 -04:00
|
|
|
#include "common/goos/Interpreter.h"
|
2021-07-15 21:37:15 -04:00
|
|
|
#include "common/goos/ReplUtils.h"
|
|
|
|
#include "common/type_system/TypeSystem.h"
|
|
|
|
#include "goalc/compiler/CompilerException.h"
|
|
|
|
#include "goalc/compiler/CompilerSettings.h"
|
|
|
|
#include "goalc/compiler/Env.h"
|
2020-09-06 16:58:25 -04:00
|
|
|
#include "goalc/compiler/IR.h"
|
2021-07-15 21:37:15 -04:00
|
|
|
#include "goalc/compiler/SymbolInfo.h"
|
2020-10-31 14:07:43 -04:00
|
|
|
#include "goalc/debugger/Debugger.h"
|
2021-02-05 15:00:17 -05:00
|
|
|
#include "goalc/emitter/Register.h"
|
2021-07-15 21:37:15 -04:00
|
|
|
#include "goalc/listener/Listener.h"
|
|
|
|
#include "goalc/make/MakeSystem.h"
|
2020-08-27 20:53:11 -04:00
|
|
|
|
2020-09-12 20:41:12 -04:00
|
|
|
enum MathMode { MATH_INT, MATH_BINT, MATH_FLOAT, MATH_INVALID };
|
|
|
|
|
2021-03-03 20:52:25 -05:00
|
|
|
enum class ReplStatus { OK, WANT_EXIT, WANT_RELOAD };
|
|
|
|
|
2020-08-27 20:53:11 -04:00
|
|
|
class Compiler {
|
|
|
|
public:
|
2021-03-07 23:41:21 -05:00
|
|
|
Compiler(std::unique_ptr<ReplWrapper> repl = nullptr);
|
2021-05-01 10:33:41 -04:00
|
|
|
ReplStatus execute_repl(bool auto_listen = false);
|
2020-09-13 10:40:21 -04:00
|
|
|
goos::Interpreter& get_goos() { return m_goos; }
|
2020-09-06 12:45:31 -04:00
|
|
|
FileEnv* compile_object_file(const std::string& name, goos::Object code, bool allow_emit);
|
|
|
|
std::unique_ptr<FunctionEnv> compile_top_level_function(const std::string& name,
|
|
|
|
const goos::Object& code,
|
|
|
|
Env* env);
|
|
|
|
Val* compile(const goos::Object& code, Env* env);
|
|
|
|
Val* compile_error_guard(const goos::Object& code, Env* env);
|
|
|
|
None* get_none() { return m_none.get(); }
|
2020-10-31 14:07:43 -04:00
|
|
|
std::vector<std::string> run_test_from_file(const std::string& source_code);
|
2020-11-13 22:33:57 -05:00
|
|
|
std::vector<std::string> run_test_from_string(const std::string& src,
|
|
|
|
const std::string& obj_name = "*listener*");
|
2020-09-12 20:41:12 -04:00
|
|
|
std::vector<std::string> run_test_no_load(const std::string& source_code);
|
2020-12-08 21:41:36 -05:00
|
|
|
void compile_and_send_from_string(const std::string& source_code);
|
2020-11-19 21:22:16 -05:00
|
|
|
void run_front_end_on_string(const std::string& src);
|
2021-05-11 16:43:13 -04:00
|
|
|
void run_front_end_on_file(const std::vector<std::string>& path);
|
2021-03-03 15:42:55 -05:00
|
|
|
void run_full_compiler_on_string_no_save(const std::string& src);
|
2020-09-06 16:58:25 -04:00
|
|
|
void shutdown_target();
|
2020-10-24 22:51:40 -04:00
|
|
|
void enable_throw_on_redefines() { m_throw_on_define_extern_redefinition = true; }
|
2020-10-31 14:07:43 -04:00
|
|
|
Debugger& get_debugger() { return m_debugger; }
|
2020-11-13 22:33:57 -05:00
|
|
|
listener::Listener& listener() { return m_listener; }
|
2020-10-31 14:07:43 -04:00
|
|
|
void poke_target() { m_listener.send_poke(); }
|
|
|
|
bool connect_to_target();
|
2021-03-07 23:41:21 -05:00
|
|
|
Replxx::completions_t find_symbols_by_prefix(std::string const& context,
|
|
|
|
int& contextLen,
|
|
|
|
std::vector<std::string> const& user_data);
|
|
|
|
Replxx::hints_t find_hints_by_prefix(std::string const& context,
|
|
|
|
int& contextLen,
|
|
|
|
Replxx::Color& color,
|
|
|
|
std::vector<std::string> const& user_data);
|
|
|
|
void repl_coloring(std::string const& str,
|
|
|
|
Replxx::colors_t& colors,
|
|
|
|
std::vector<std::pair<std::string, Replxx::Color>> const& user_data);
|
2021-07-15 21:37:15 -04:00
|
|
|
bool knows_object_file(const std::string& name);
|
2020-09-06 16:58:25 -04:00
|
|
|
|
2020-08-27 20:53:11 -04:00
|
|
|
private:
|
2021-07-15 21:37:15 -04:00
|
|
|
TypeSystem m_ts;
|
|
|
|
std::unique_ptr<GlobalEnv> m_global_env = nullptr;
|
|
|
|
std::unique_ptr<None> m_none = nullptr;
|
|
|
|
bool m_want_exit = false;
|
|
|
|
bool m_want_reload = false;
|
|
|
|
listener::Listener m_listener;
|
|
|
|
Debugger m_debugger;
|
|
|
|
goos::Interpreter m_goos;
|
|
|
|
std::unordered_map<std::string, TypeSpec> m_symbol_types;
|
|
|
|
std::unordered_map<std::shared_ptr<goos::SymbolObject>, goos::Object> m_global_constants;
|
|
|
|
std::unordered_map<std::shared_ptr<goos::SymbolObject>, LambdaVal*> m_inlineable_functions;
|
|
|
|
CompilerSettings m_settings;
|
|
|
|
bool m_throw_on_define_extern_redefinition = false;
|
|
|
|
SymbolInfoMap m_symbol_info;
|
|
|
|
std::unique_ptr<ReplWrapper> m_repl;
|
|
|
|
MakeSystem m_make;
|
|
|
|
|
2021-08-01 17:46:55 -04:00
|
|
|
struct DebugStats {
|
|
|
|
int num_spills = 0;
|
|
|
|
int num_spills_v1 = 0;
|
|
|
|
int num_moves_eliminated = 0;
|
|
|
|
int total_funcs = 0;
|
|
|
|
int funcs_requiring_v1_allocator = 0;
|
|
|
|
} m_debug_stats;
|
|
|
|
|
2021-08-02 22:01:10 -04:00
|
|
|
void setup_goos_forms();
|
2021-06-30 00:11:46 -04:00
|
|
|
std::set<std::string> lookup_symbol_infos_starting_with(const std::string& prefix) const;
|
|
|
|
std::vector<SymbolInfo>* lookup_exact_name_info(const std::string& name) const;
|
2020-12-04 12:57:10 -05:00
|
|
|
bool get_true_or_false(const goos::Object& form, const goos::Object& boolean);
|
2020-09-06 17:42:20 -04:00
|
|
|
bool try_getting_macro_from_goos(const goos::Object& macro_name, goos::Object* dest);
|
2021-04-02 11:35:14 -04:00
|
|
|
bool expand_macro_once(const goos::Object& src, goos::Object* out, Env* env);
|
|
|
|
goos::Object expand_macro_completely(const goos::Object& src, Env* env);
|
|
|
|
|
2020-11-29 18:01:30 -05:00
|
|
|
void set_bitfield(const goos::Object& form, BitFieldVal* dst, RegVal* src, Env* env);
|
2021-05-18 21:25:29 -04:00
|
|
|
void set_bitfield_128(const goos::Object& form, BitFieldVal* dst, RegVal* src, Env* env);
|
|
|
|
|
|
|
|
void set_bits_in_bitfield(int size,
|
|
|
|
int offset,
|
|
|
|
RegVal* dst,
|
|
|
|
RegVal* src,
|
|
|
|
FunctionEnv* fe,
|
|
|
|
Env* env);
|
|
|
|
|
2020-12-05 17:09:46 -05:00
|
|
|
Val* do_set(const goos::Object& form, Val* dst, RegVal* src_in_reg, Val* src, Env* env);
|
2020-09-06 17:42:20 -04:00
|
|
|
Val* compile_goos_macro(const goos::Object& o,
|
|
|
|
const goos::Object& macro_obj,
|
|
|
|
const goos::Object& rest,
|
|
|
|
Env* env);
|
2020-09-06 12:45:31 -04:00
|
|
|
Val* compile_pair(const goos::Object& code, Env* env);
|
|
|
|
Val* compile_integer(const goos::Object& code, Env* env);
|
2021-05-18 21:25:29 -04:00
|
|
|
Val* compile_integer(const U128& value, Env* env);
|
2020-09-06 12:45:31 -04:00
|
|
|
Val* compile_integer(s64 value, Env* env);
|
2020-11-19 21:22:16 -05:00
|
|
|
Val* compile_char(const goos::Object& code, Env* env);
|
2020-09-13 10:40:21 -04:00
|
|
|
Val* compile_float(const goos::Object& code, Env* env);
|
|
|
|
Val* compile_float(float value, Env* env, int seg);
|
2020-09-07 13:28:16 -04:00
|
|
|
Val* compile_symbol(const goos::Object& form, Env* env);
|
2020-09-12 13:11:42 -04:00
|
|
|
Val* compile_string(const goos::Object& form, Env* env);
|
|
|
|
Val* compile_string(const std::string& str, Env* env, int seg = MAIN_SEGMENT);
|
2020-12-01 21:39:46 -05:00
|
|
|
Val* compile_get_symbol_value(const goos::Object& form, const std::string& name, Env* env);
|
2020-09-12 13:11:42 -04:00
|
|
|
Val* compile_function_or_method_call(const goos::Object& form, Env* env);
|
2020-10-14 13:42:14 -04:00
|
|
|
|
2020-12-30 15:33:51 -05:00
|
|
|
Val* compile_asm_vf_math3(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
IR_VFMath3Asm::Kind kind,
|
2021-02-05 15:00:17 -05:00
|
|
|
emitter::Register::VF_ELEMENT broadcastElement,
|
2020-12-30 15:33:51 -05:00
|
|
|
Env* env);
|
|
|
|
|
2021-03-28 20:26:30 -04:00
|
|
|
Val* compile_asm_int128_math3(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
IR_Int128Math3Asm::Kind kind,
|
|
|
|
Env* env);
|
|
|
|
|
2021-02-20 11:42:46 -05:00
|
|
|
Val* compile_asm_vf_math2(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
IR_VFMath2Asm::Kind kind,
|
|
|
|
Env* env);
|
|
|
|
|
2021-04-26 21:40:08 -04:00
|
|
|
Val* compile_asm_int128_math2_imm_u8(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
IR_Int128Math2Asm::Kind kind,
|
|
|
|
Env* env);
|
2021-02-20 11:42:46 -05:00
|
|
|
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_vf_math4_two_operation(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
IR_VFMath3Asm::Kind first_op_kind,
|
|
|
|
IR_VFMath3Asm::Kind second_op_kind,
|
|
|
|
emitter::Register::VF_ELEMENT broadcastElement,
|
|
|
|
Env* env);
|
|
|
|
|
2020-10-14 13:42:14 -04:00
|
|
|
Val* get_field_of_structure(const StructureType* type,
|
|
|
|
Val* object,
|
|
|
|
const std::string& field_name,
|
|
|
|
Env* env);
|
|
|
|
|
2021-05-01 15:29:56 -04:00
|
|
|
Val* get_field_of_bitfield(const BitFieldType* type,
|
|
|
|
Val* object,
|
|
|
|
const std::string& field_name,
|
|
|
|
Env* env);
|
|
|
|
|
2020-09-07 13:28:16 -04:00
|
|
|
SymbolVal* compile_get_sym_obj(const std::string& name, Env* env);
|
2020-09-06 16:58:25 -04:00
|
|
|
void color_object_file(FileEnv* env);
|
|
|
|
std::vector<u8> codegen_object_file(FileEnv* env);
|
2020-12-01 21:39:46 -05:00
|
|
|
bool codegen_and_disassemble_object_file(FileEnv* env,
|
|
|
|
std::vector<u8>* data_out,
|
|
|
|
std::string* asm_out);
|
2020-09-06 12:45:31 -04:00
|
|
|
|
2020-09-06 16:58:25 -04:00
|
|
|
void for_each_in_list(const goos::Object& list,
|
|
|
|
const std::function<void(const goos::Object&)>& f);
|
2020-09-06 12:45:31 -04:00
|
|
|
|
|
|
|
goos::Arguments get_va(const goos::Object& form, const goos::Object& rest);
|
2020-11-20 20:17:37 -05:00
|
|
|
void va_check(const goos::Object& form,
|
|
|
|
const goos::Arguments& args,
|
|
|
|
const std::vector<std::optional<goos::ObjectType>>& unnamed,
|
|
|
|
const std::unordered_map<std::string,
|
|
|
|
std::pair<bool, std::optional<goos::ObjectType>>>& named);
|
2020-09-07 13:28:16 -04:00
|
|
|
std::string as_string(const goos::Object& o);
|
|
|
|
std::string symbol_string(const goos::Object& o);
|
2020-09-19 13:22:14 -04:00
|
|
|
std::string quoted_sym_as_string(const goos::Object& o);
|
2020-12-06 15:42:26 -05:00
|
|
|
goos::Object unquote(const goos::Object& o);
|
2020-10-16 17:08:26 -04:00
|
|
|
bool is_quoted_sym(const goos::Object& o);
|
2020-09-19 16:50:42 -04:00
|
|
|
bool is_basic(const TypeSpec& ts);
|
2020-10-16 17:08:26 -04:00
|
|
|
bool is_structure(const TypeSpec& ts);
|
2020-11-29 18:01:30 -05:00
|
|
|
bool is_bitfield(const TypeSpec& ts);
|
2020-12-19 15:21:29 -05:00
|
|
|
bool is_pair(const TypeSpec& ts);
|
|
|
|
std::vector<goos::Object> get_list_as_vector(const goos::Object& o,
|
|
|
|
goos::Object* rest_out = nullptr,
|
|
|
|
int max_length = -1);
|
2020-09-07 19:17:48 -04:00
|
|
|
const goos::Object& pair_car(const goos::Object& o);
|
|
|
|
const goos::Object& pair_cdr(const goos::Object& o);
|
|
|
|
void expect_empty_list(const goos::Object& o);
|
2020-09-12 13:11:42 -04:00
|
|
|
void typecheck(const goos::Object& form,
|
|
|
|
const TypeSpec& expected,
|
|
|
|
const TypeSpec& actual,
|
|
|
|
const std::string& error_message = "");
|
2020-12-05 17:09:46 -05:00
|
|
|
void typecheck_reg_type_allow_false(const goos::Object& form,
|
|
|
|
const TypeSpec& expected,
|
|
|
|
const Val* actual,
|
|
|
|
const std::string& error_message = "");
|
2020-09-12 13:11:42 -04:00
|
|
|
|
|
|
|
TypeSpec parse_typespec(const goos::Object& src);
|
|
|
|
bool is_local_symbol(const goos::Object& obj, Env* env);
|
2020-12-30 15:33:51 -05:00
|
|
|
emitter::HWRegKind get_preferred_reg_kind(const TypeSpec& ts);
|
2020-09-12 13:11:42 -04:00
|
|
|
Val* compile_real_function_call(const goos::Object& form,
|
|
|
|
RegVal* function,
|
|
|
|
const std::vector<RegVal*>& args,
|
2020-09-19 16:50:42 -04:00
|
|
|
Env* env,
|
2020-09-24 17:19:23 -04:00
|
|
|
const std::string& method_type_name = "");
|
2020-09-05 16:37:37 -04:00
|
|
|
|
2020-10-14 13:42:14 -04:00
|
|
|
bool try_getting_constant_integer(const goos::Object& in, int64_t* out, Env* env);
|
2021-04-11 19:21:49 -04:00
|
|
|
bool try_getting_constant_float(const goos::Object& in, float* out, Env* env);
|
2020-12-06 15:42:26 -05:00
|
|
|
Val* compile_heap_new(const goos::Object& form,
|
|
|
|
const std::string& allocation,
|
|
|
|
const goos::Object& type,
|
|
|
|
const goos::Object* rest,
|
|
|
|
Env* env);
|
|
|
|
Val* compile_static_new(const goos::Object& form,
|
|
|
|
const goos::Object& type,
|
|
|
|
const goos::Object* rest,
|
|
|
|
Env* env);
|
|
|
|
Val* compile_stack_new(const goos::Object& form,
|
|
|
|
const goos::Object& type,
|
|
|
|
const goos::Object* rest,
|
2021-02-13 11:32:52 -05:00
|
|
|
Env* env,
|
|
|
|
bool call_constructor);
|
2020-10-14 13:42:14 -04:00
|
|
|
|
2021-06-07 20:22:06 -04:00
|
|
|
StaticResult fill_static_array(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
|
|
|
StaticResult fill_static_boxed_array(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
Env* env);
|
2021-02-20 11:42:46 -05:00
|
|
|
|
2021-02-25 22:49:46 -05:00
|
|
|
StaticResult fill_static_inline_array(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
Env* env);
|
|
|
|
|
|
|
|
void fill_static_inline_array_inline(const goos::Object& form,
|
|
|
|
const TypeSpec& content_type,
|
|
|
|
const std::vector<goos::Object>& args,
|
|
|
|
StaticStructure* structure,
|
|
|
|
int offset,
|
|
|
|
Env* env);
|
|
|
|
void fill_static_array_inline(const goos::Object& form,
|
|
|
|
const TypeSpec& content_type,
|
2021-06-07 20:22:06 -04:00
|
|
|
goos::Object* args_array,
|
|
|
|
int args_array_length,
|
2021-02-25 22:49:46 -05:00
|
|
|
StaticStructure* structure,
|
|
|
|
int offset,
|
|
|
|
Env* env);
|
|
|
|
|
2021-03-04 10:33:59 -05:00
|
|
|
std::string make_symbol_info_description(const SymbolInfo& info);
|
|
|
|
|
2020-09-12 20:41:12 -04:00
|
|
|
MathMode get_math_mode(const TypeSpec& ts);
|
|
|
|
bool is_number(const TypeSpec& ts);
|
|
|
|
bool is_float(const TypeSpec& ts);
|
|
|
|
bool is_integer(const TypeSpec& ts);
|
|
|
|
bool is_binteger(const TypeSpec& ts);
|
|
|
|
bool is_singed_integer_or_binteger(const TypeSpec& ts);
|
2020-12-01 21:39:46 -05:00
|
|
|
Val* number_to_integer(const goos::Object& form, Val* in, Env* env);
|
|
|
|
Val* number_to_float(const goos::Object& form, Val* in, Env* env);
|
|
|
|
Val* number_to_binteger(const goos::Object& form, Val* in, Env* env);
|
|
|
|
Val* to_math_type(const goos::Object& form, Val* in, MathMode mode, Env* env);
|
2020-09-13 17:34:02 -04:00
|
|
|
bool is_none(Val* in);
|
2020-12-04 12:57:10 -05:00
|
|
|
emitter::Register parse_register(const goos::Object& code);
|
2020-12-05 17:09:46 -05:00
|
|
|
u64 enum_lookup(const goos::Object& form,
|
2021-04-22 19:08:58 -04:00
|
|
|
const EnumType* e,
|
2020-12-05 17:09:46 -05:00
|
|
|
const goos::Object& rest,
|
|
|
|
bool throw_on_error,
|
|
|
|
bool* success);
|
2020-12-02 19:51:42 -05:00
|
|
|
Val* compile_enum_lookup(const goos::Object& form,
|
2021-04-22 19:08:58 -04:00
|
|
|
const EnumType* e,
|
2020-12-02 19:51:42 -05:00
|
|
|
const goos::Object& rest,
|
|
|
|
Env* env);
|
2020-09-06 12:45:31 -04:00
|
|
|
|
2020-12-01 21:39:46 -05:00
|
|
|
Val* compile_variable_shift(const goos::Object& form,
|
|
|
|
const RegVal* in,
|
|
|
|
const RegVal* sa,
|
|
|
|
Env* env,
|
|
|
|
IntegerMathKind kind);
|
|
|
|
Val* compile_fixed_shift(const goos::Object& form,
|
|
|
|
const RegVal* in,
|
|
|
|
u8 sa,
|
|
|
|
Env* env,
|
|
|
|
IntegerMathKind kind);
|
2020-09-14 20:24:05 -04:00
|
|
|
|
2020-10-15 00:34:52 -04:00
|
|
|
Val* compile_format_string(const goos::Object& form,
|
|
|
|
Env* env,
|
2020-10-16 17:08:26 -04:00
|
|
|
const std::string& fmt_template,
|
2020-10-15 00:34:52 -04:00
|
|
|
std::vector<RegVal*> args,
|
|
|
|
const std::string& out_stream = "#t");
|
2020-10-16 17:08:26 -04:00
|
|
|
void generate_field_description(const goos::Object& form,
|
|
|
|
StructureType* type,
|
2020-10-15 21:13:52 -04:00
|
|
|
Env* env,
|
|
|
|
RegVal* reg,
|
2021-07-11 16:35:25 -04:00
|
|
|
const Field& f,
|
|
|
|
int tab_count);
|
|
|
|
Val* generate_inspector_for_structure_type(const goos::Object& form,
|
|
|
|
Env* env,
|
|
|
|
StructureType* structure_type);
|
2021-05-01 15:29:56 -04:00
|
|
|
Val* generate_inspector_for_bitfield_type(const goos::Object& form, Env* env, BitFieldType* type);
|
2020-12-01 21:39:46 -05:00
|
|
|
RegVal* compile_get_method_of_type(const goos::Object& form,
|
2021-06-25 17:55:50 -04:00
|
|
|
const TypeSpec& compile_time_type,
|
|
|
|
RegVal* type_object,
|
|
|
|
const std::string& method_name,
|
|
|
|
Env* env);
|
|
|
|
RegVal* compile_get_method_of_type(const goos::Object& form,
|
|
|
|
const TypeSpec& compile_time_type,
|
2020-09-17 21:47:52 -04:00
|
|
|
const std::string& method_name,
|
|
|
|
Env* env);
|
2020-12-01 21:39:46 -05:00
|
|
|
RegVal* compile_get_method_of_object(const goos::Object& form,
|
|
|
|
RegVal* object,
|
|
|
|
const std::string& method_name,
|
2021-04-25 14:48:54 -04:00
|
|
|
Env* env,
|
|
|
|
bool error_message_function_or_method = false);
|
2020-10-16 17:08:26 -04:00
|
|
|
Val* compile_define_constant(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
Env* env,
|
|
|
|
bool goos,
|
|
|
|
bool goal);
|
|
|
|
|
|
|
|
Val* compile_new_static_structure_or_basic(const goos::Object& form,
|
|
|
|
const TypeSpec& type,
|
|
|
|
const goos::Object& field_defs,
|
|
|
|
Env* env);
|
2020-12-19 15:21:29 -05:00
|
|
|
Val* compile_static_pair(const goos::Object& form, Env* env);
|
|
|
|
StaticResult compile_static(const goos::Object& form, Env* env);
|
|
|
|
StaticResult compile_static_no_eval_for_pairs(const goos::Object& form, Env* env);
|
2021-04-11 19:21:49 -04:00
|
|
|
|
|
|
|
Val* compile_bitfield_definition(const goos::Object& form,
|
|
|
|
const TypeSpec& type,
|
|
|
|
const goos::Object& _field_defs,
|
|
|
|
bool allow_dynamic_construction,
|
|
|
|
Env* env);
|
2020-12-19 15:21:29 -05:00
|
|
|
StaticResult compile_new_static_structure(const goos::Object& form,
|
|
|
|
const TypeSpec& type,
|
|
|
|
const goos::Object& _field_defs,
|
|
|
|
Env* env);
|
|
|
|
|
|
|
|
void compile_static_structure_inline(const goos::Object& form,
|
|
|
|
const TypeSpec& type,
|
|
|
|
const goos::Object& _field_defs,
|
|
|
|
StaticStructure* structure,
|
|
|
|
int offset,
|
|
|
|
Env* env);
|
2020-12-31 22:15:17 -05:00
|
|
|
void compile_constant_product(RegVal* dest, RegVal* src, int stride, Env* env);
|
2021-02-16 21:41:33 -05:00
|
|
|
void check_vector_float_regs(const goos::Object& form,
|
|
|
|
Env* env,
|
|
|
|
std::vector<std::pair<std::string, RegVal*>> args);
|
|
|
|
u8 ftf_fsf_to_blend_mask(u8 val);
|
|
|
|
emitter::Register::VF_ELEMENT ftf_fsf_to_vector_element(u8 val);
|
2021-04-18 19:51:15 -04:00
|
|
|
int get_size_for_size_of(const goos::Object& form, const goos::Object& rest);
|
2020-09-17 21:47:52 -04:00
|
|
|
|
2020-12-01 21:39:46 -05:00
|
|
|
template <typename... Args>
|
|
|
|
void throw_compiler_error(const goos::Object& code, const std::string& str, Args&&... args) {
|
|
|
|
fmt::print(fg(fmt::color::crimson) | fmt::emphasis::bold, "-- Compilation Error! --\n");
|
|
|
|
if (!str.empty() && str.back() == '\n') {
|
|
|
|
fmt::print(str, std::forward<Args>(args)...);
|
|
|
|
} else {
|
|
|
|
fmt::print(str + '\n', std::forward<Args>(args)...);
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Form:\n");
|
|
|
|
fmt::print("{}\n", code.print());
|
|
|
|
throw CompilerException("Compilation Error");
|
|
|
|
}
|
|
|
|
|
2020-12-04 12:57:10 -05:00
|
|
|
template <typename... Args>
|
|
|
|
void throw_compiler_error_no_code(const std::string& str, Args&&... args) {
|
|
|
|
fmt::print(fg(fmt::color::crimson) | fmt::emphasis::bold, "-- Compilation Error! --\n");
|
|
|
|
if (!str.empty() && str.back() == '\n') {
|
|
|
|
fmt::print(str, std::forward<Args>(args)...);
|
|
|
|
} else {
|
|
|
|
fmt::print(str + '\n', std::forward<Args>(args)...);
|
|
|
|
}
|
|
|
|
|
|
|
|
fmt::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Form:\n");
|
|
|
|
throw CompilerException("Compilation Error");
|
|
|
|
}
|
|
|
|
|
2020-12-02 19:51:42 -05:00
|
|
|
template <typename... Args>
|
|
|
|
void print_compiler_warning(const std::string& str, Args&&... args) {
|
|
|
|
fmt::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "[Warning] ");
|
|
|
|
if (!str.empty() && str.back() == '\n') {
|
|
|
|
fmt::print(str, std::forward<Args>(args)...);
|
|
|
|
} else {
|
|
|
|
fmt::print(str + '\n', std::forward<Args>(args)...);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-09-06 12:45:31 -04:00
|
|
|
public:
|
2020-12-04 12:57:10 -05:00
|
|
|
// Asm
|
|
|
|
Val* compile_rlet(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_ret(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_push(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pop(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_sub(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-12-05 17:09:46 -05:00
|
|
|
Val* compile_asm_add(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_load_sym(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_jr(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mov(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-05 15:00:17 -05:00
|
|
|
|
2021-02-16 21:41:33 -05:00
|
|
|
// Vector Float Operations
|
2020-12-30 15:33:51 -05:00
|
|
|
Val* compile_asm_lvf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_svf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-06 10:46:26 -05:00
|
|
|
Val* compile_asm_mov_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_blend_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
|
|
|
Val* compile_asm_wait_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_nop_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
2020-12-30 15:33:51 -05:00
|
|
|
Val* compile_asm_xor_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-05 15:00:17 -05:00
|
|
|
|
|
|
|
Val* compile_asm_max_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_max_x_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_max_y_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_max_z_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_max_w_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-05 15:00:17 -05:00
|
|
|
|
|
|
|
Val* compile_asm_min_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_min_x_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_min_y_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_min_z_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_min_w_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-05 15:00:17 -05:00
|
|
|
|
2020-12-30 15:33:51 -05:00
|
|
|
Val* compile_asm_sub_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_sub_x_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_sub_y_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_sub_z_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_sub_w_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-05 15:00:17 -05:00
|
|
|
|
2020-12-30 15:33:51 -05:00
|
|
|
Val* compile_asm_add_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_add_x_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_add_y_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_add_z_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_add_w_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-05 15:00:17 -05:00
|
|
|
|
|
|
|
Val* compile_asm_mul_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_mul_x_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_y_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_z_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_w_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
|
|
|
Val* compile_asm_mul_add_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_add_x_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_add_y_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_add_z_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_add_w_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
|
|
|
Val* compile_asm_mul_sub_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_sub_x_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_sub_y_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_sub_z_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_mul_sub_w_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-05 15:00:17 -05:00
|
|
|
|
|
|
|
Val* compile_asm_abs_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_outer_product_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-05 15:00:17 -05:00
|
|
|
|
2021-02-16 21:41:33 -05:00
|
|
|
Val* compile_asm_div_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_sqrt_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-06 10:46:26 -05:00
|
|
|
Val* compile_asm_inv_sqrt_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-20 11:42:46 -05:00
|
|
|
Val* compile_asm_itof_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_ftoi_vf(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pw_sll(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pw_srl(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pw_sra(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-07-27 19:57:14 -04:00
|
|
|
|
|
|
|
Val* compile_asm_por(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pnor(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pand(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
|
|
|
Val* compile_asm_pceqb(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pceqh(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pceqw(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
|
|
|
Val* compile_asm_pcgtb(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pcgth(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pcgtw(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
|
|
|
Val* compile_asm_pextub(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pextuh(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-28 20:26:30 -04:00
|
|
|
Val* compile_asm_pextuw(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-07-27 19:57:14 -04:00
|
|
|
|
|
|
|
Val* compile_asm_pextlb(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pextlh(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pextlw(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
|
2021-03-28 20:26:30 -04:00
|
|
|
Val* compile_asm_pcpyud(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_pcpyld(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_ppach(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-04-28 17:14:54 -04:00
|
|
|
Val* compile_asm_psubw(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-28 20:26:30 -04:00
|
|
|
Val* compile_asm_xorp(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-12-30 15:33:51 -05:00
|
|
|
|
2020-09-07 13:28:16 -04:00
|
|
|
// Atoms
|
|
|
|
|
|
|
|
// Block
|
2020-09-06 12:45:31 -04:00
|
|
|
Val* compile_begin(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-07 13:28:16 -04:00
|
|
|
Val* compile_top_level(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-07 19:17:48 -04:00
|
|
|
Val* compile_block(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_return_from(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_label(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_goto(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-07 18:21:00 -05:00
|
|
|
Val* compile_nop(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-07 13:28:16 -04:00
|
|
|
|
|
|
|
// CompilerControl
|
2020-09-06 17:42:20 -04:00
|
|
|
Val* compile_seval(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-07 13:28:16 -04:00
|
|
|
Val* compile_exit(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_asm_file(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-07 23:41:21 -05:00
|
|
|
Val* compile_repl_clear_screen(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-11-19 21:22:16 -05:00
|
|
|
Val* compile_asm_data_file(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-02 13:16:47 -05:00
|
|
|
Val* compile_repl_help(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-07 13:28:16 -04:00
|
|
|
Val* compile_listen_to_target(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_reset_target(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_poke(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-12 13:11:42 -04:00
|
|
|
Val* compile_gs(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_set_config(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-12 20:41:12 -04:00
|
|
|
Val* compile_in_package(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_build_dgo(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-03 20:52:25 -05:00
|
|
|
Val* compile_reload(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-04 10:33:59 -05:00
|
|
|
Val* compile_get_info(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_autocomplete(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-03-11 12:54:16 -05:00
|
|
|
Val* compile_add_macro_to_autocomplete(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
Env* env);
|
2021-07-15 21:37:15 -04:00
|
|
|
Val* compile_load_project(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_make(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-08-01 17:46:55 -04:00
|
|
|
Val* compile_print_debug_compiler_stats(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
Env* env);
|
2020-09-07 13:28:16 -04:00
|
|
|
|
2020-09-13 17:34:02 -04:00
|
|
|
// ControlFlow
|
|
|
|
Condition compile_condition(const goos::Object& condition, Env* env, bool invert);
|
|
|
|
Val* compile_condition_as_bool(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_when_goto(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_cond(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-03 16:12:51 -05:00
|
|
|
Val* compile_and_or(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-13 17:34:02 -04:00
|
|
|
|
2020-09-07 13:28:16 -04:00
|
|
|
// Define
|
|
|
|
Val* compile_define(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-12 13:11:42 -04:00
|
|
|
Val* compile_define_extern(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-13 17:34:02 -04:00
|
|
|
Val* compile_set(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-07 13:28:16 -04:00
|
|
|
|
2020-10-31 14:07:43 -04:00
|
|
|
// Debug
|
|
|
|
Val* compile_dbg(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_dbs(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_break(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_cont(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_dump_all(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-11-06 13:59:39 -05:00
|
|
|
Val* compile_pm(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_di(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_disasm(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_bp(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_ubp(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
u32 parse_address_spec(const goos::Object& form);
|
2020-10-31 14:07:43 -04:00
|
|
|
|
2020-09-07 13:28:16 -04:00
|
|
|
// Macro
|
|
|
|
Val* compile_gscond(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_quote(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-07 19:17:48 -04:00
|
|
|
Val* compile_defglobalconstant(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-10-16 17:08:26 -04:00
|
|
|
Val* compile_defconstant(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-13 17:34:02 -04:00
|
|
|
Val* compile_mlet(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-12 13:11:42 -04:00
|
|
|
|
2020-09-12 20:41:12 -04:00
|
|
|
// Math
|
|
|
|
Val* compile_add(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_sub(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_mul(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-11-28 20:53:13 -05:00
|
|
|
Val* compile_imul64(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-13 12:11:49 -04:00
|
|
|
Val* compile_div(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-11-29 18:01:30 -05:00
|
|
|
Val* compile_shl(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_sar(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_shr(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-14 20:24:05 -04:00
|
|
|
Val* compile_mod(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_logxor(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_lognot(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_logand(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_logior(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-25 21:11:27 -04:00
|
|
|
Val* compile_pointer_add(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-11-29 10:46:14 -05:00
|
|
|
Val* compile_fmin(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_fmax(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-17 00:57:21 -05:00
|
|
|
Val* compile_sqrtf(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-12 20:41:12 -04:00
|
|
|
|
2020-09-12 13:11:42 -04:00
|
|
|
// Function
|
|
|
|
Val* compile_lambda(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_inline(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-13 10:40:21 -04:00
|
|
|
Val* compile_declare(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-01 20:41:37 -05:00
|
|
|
Val* compile_local_vars(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-17 21:47:52 -04:00
|
|
|
|
|
|
|
// Type
|
|
|
|
Val* compile_deftype(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-18 22:02:27 -04:00
|
|
|
Val* compile_defmethod(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_deref(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-19 13:22:14 -04:00
|
|
|
Val* compile_the_as(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_the(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_print_type(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_new(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_car(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_cdr(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-02-03 11:07:47 -05:00
|
|
|
Val* compile_method_of_type(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_method_of_object(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-09-25 21:11:27 -04:00
|
|
|
Val* compile_addr_of(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-10-16 17:08:26 -04:00
|
|
|
Val* compile_declare_type(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-10-17 11:18:58 -04:00
|
|
|
Val* compile_none(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-12-02 19:51:42 -05:00
|
|
|
Val* compile_defenum(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-04-18 19:51:15 -04:00
|
|
|
Val* compile_size_of(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-06-06 23:02:00 -04:00
|
|
|
Val* compile_psize_of(const goos::Object& form, const goos::Object& rest, Env* env);
|
2021-08-17 20:54:03 -04:00
|
|
|
|
|
|
|
// State
|
|
|
|
Val* compile_define_state_hook(const goos::Object& form, const goos::Object& rest, Env* env);
|
|
|
|
Val* compile_define_virtual_state_hook(const goos::Object& form,
|
|
|
|
const goos::Object& rest,
|
|
|
|
Env* env);
|
|
|
|
Val* compile_go_hook(const goos::Object& form, const goos::Object& rest, Env* env);
|
2020-08-27 20:53:11 -04:00
|
|
|
};
|
|
|
|
|
2021-03-04 10:33:59 -05:00
|
|
|
extern const std::unordered_map<
|
|
|
|
std::string,
|
|
|
|
Val* (Compiler::*)(const goos::Object& form, const goos::Object& rest, Env* env)>
|
|
|
|
g_goal_forms;
|