24#include "llvm-c/Core.h"
25#include "llvm-c/Types.h"
152#define SIZE_OF_VALUE_PALYLOAD 8
154 "srn_value_t's union has the wrong size");
160#define TYPE(value_ref) ((value_ref)->type)
161#define METADATA(value_ref) ((value_ref)->metadata)
162#define IS_A(value_ref, field) (TYPE(value_ref) == (field))
163#define IS_TRUE(value_ref) (TYPE(value_ref) == VTrue)
164#define IS_FALSE(value_ref) (TYPE(value_ref) == VFalse)
165#define IS_NIL(value_ref) (TYPE(value_ref) == VNil)
167#define AS_I64(value_ref) ((value_ref)->as.i64)
168#define AS_F64(value_ref) ((value_ref)->as.f64)
169#define AS_CLOSURE(value_ref) ((value_ref)->as.closure)
170#define AS_NS(value_ref) ((value_ref)->as.ns)
171#define AS_STRING(value_ref) ((value_ref)->as.string)
172#define AS_SYMBOL(value_ref) ((value_ref)->as.symbol)
173#define AS_ERROR(value_ref) ((value_ref)->as.error)
174#define AS_LIST(value_ref) ((value_ref)->as.list)
175#define AS_KEYWORD(value_ref) ((value_ref)->as.keyword)
176#define AS_SEQ(value_ref) ((value_ref)->as.seq)
177#define AS_MAP(value_ref) ((value_ref)->as.map)
181[[nodiscard]] [[gnu::nonnull(1)]] [[gnu::returns_nonnull]]
187 LLVMTypeRef i64t = LLVMInt64TypeInContext(llctx);
190 LLVMTypeRef i8t = LLVMInt8TypeInContext(llctx);
191 LLVMTypeRef ptrt = LLVMPointerType(i8t, 0);
193 LLVMTypeRef fields[3];
198 LLVMTypeRef st = LLVMStructCreateNamed(llctx,
"srn_value_t");
199 LLVMStructSetBody(st, fields, 3, 0);
static LLVMTypeRef srn_llvm_value_t(LLVMContextRef llctx)
LLVM type for srn_value_t in LLVM IR. { i64, ptr, i64 }.
struct srn_string_t srn_string_t
srn_value_t * srn_value_make(srn_context_t *ctx, srn_value_tag_t tag, srn_metadata_t *metadata, void *payload)
Creates a new serene value.
struct srn_keyword_t srn_keyword_t
static srn_metadata_t absurd_metadata
We use this for testing.
struct srn_namespace_t srn_namespace_t
static srn_value_t false_v
@ VError
VError should be last.
struct srn_map_t srn_map_t
enum srn_syntax_tag_e srn_syntax_tag_t
#define SIZE_OF_VALUE_PALYLOAD
@ SError
SError should be last.
struct srn_error_t srn_error_t
struct srn_symbol_t srn_symbol_t
static srn_value_t true_v
struct srn_expr_t srn_expr_t
struct srn_seq_t srn_seq_t
struct srn_list_t srn_list_t
enum srn_value_tag_e srn_value_tag_t
This is an implementation of bit - partitioned, persistent, immutable sequence For more information,...
Since all the values are immutable and persistent.
A persistent, immutable map.
A persistent, immutable, indexed sequence.
uint16_t buffer_id
ID of the source buffer that is registered with the source manager.
srn_metadata_t * metadata
union srn_syntax_t::@333325137367112222275110336355257173264057161216 as
IMPORTANT NOTE: The size of this union should never be larger than a word.
struct srn_syntax_t * quote
const char * symbol
For syntax only, we represent numbers as a strings,.
srn_metadata_t * metadata
int64_t i64
We represent all the immidiate numbers with this field and cast as we to an appropriate type.
union srn_value_t::@033047061046230251001111174367071167226300135003 as
IMPORTANT NOTE: The size of this union should never be larger than a word.