Reduct  v1.0.4-3-gdaf0d70
A functional and immutable language.
Loading...
Searching...
No Matches
Intrinsics

Detailed Description

A intrinsic is an atom recognized by the bytecode compiler as a special form or built-in operator, resulting in it emitting specific bytecode instructions for each intrinsic.

This is in contrast to a "native" which will be invoked as a standard function call at runtime.

Macros

#define REDUCT_INTRINSIC_NONE   0
 None.
 
#define REDUCT_INTRINSIC_QUOTE   1
 Quote.
 
#define REDUCT_INTRINSIC_LIST   2
 List.
 
#define REDUCT_INTRINSIC_DO   3
 Do.
 
#define REDUCT_INTRINSIC_LAMBDA   4
 Lambda.
 
#define REDUCT_INTRINSIC_THREAD   5
 Thread.
 
#define REDUCT_INTRINSIC_DEF   6
 Def.
 
#define REDUCT_INTRINSIC_IF   7
 If.
 
#define REDUCT_INTRINSIC_COND   8
 Cond.
 
#define REDUCT_INTRINSIC_MATCH   9
 Match.
 
#define REDUCT_INTRINSIC_AND   10
 And.
 
#define REDUCT_INTRINSIC_OR   11
 Or.
 
#define REDUCT_INTRINSIC_NOT   12
 Not.
 
#define REDUCT_INTRINSIC_ADD   13
 Add.
 
#define REDUCT_INTRINSIC_SUB   14
 Sub.
 
#define REDUCT_INTRINSIC_MUL   15
 Mul.
 
#define REDUCT_INTRINSIC_DIV   16
 Div.
 
#define REDUCT_INTRINSIC_MOD   17
 Mod.
 
#define REDUCT_INTRINSIC_INC   18
 Inc.
 
#define REDUCT_INTRINSIC_DEC   19
 Dec.
 
#define REDUCT_INTRINSIC_BAND   20
 Bitwise And.
 
#define REDUCT_INTRINSIC_BOR   21
 Bitwise Or.
 
#define REDUCT_INTRINSIC_BXOR   22
 Bitwise Xor.
 
#define REDUCT_INTRINSIC_BNOT   23
 Bitwise Not.
 
#define REDUCT_INTRINSIC_SHL   24
 Bitwise Shift Left.
 
#define REDUCT_INTRINSIC_SHR   25
 Bitwise Shift Right.
 
#define REDUCT_INTRINSIC_EQ   26
 Equal.
 
#define REDUCT_INTRINSIC_NEQ   27
 Not Equal.
 
#define REDUCT_INTRINSIC_SEQ   28
 Strict Equal.
 
#define REDUCT_INTRINSIC_SNEQ   29
 Strict Not Equal.
 
#define REDUCT_INTRINSIC_LT   30
 Less.
 
#define REDUCT_INTRINSIC_LE   31
 Less Equal.
 
#define REDUCT_INTRINSIC_GT   32
 Greater.
 
#define REDUCT_INTRINSIC_GE   33
 Greater Equal.
 
#define REDUCT_INTRINSIC_MAX   34
 The amount of intrinsics.
 

Typedefs

typedef reduct_uint8_t reduct_intrinsic_t
 Intrinsic types.
 
typedef void(* reduct_intrinsic_handler_t) (struct reduct_compiler *compiler, struct reduct_item *expr, struct reduct_expr *out)
 Intrinsic handler function type.
 

Functions

REDUCT_API void reduct_intrinsic_register_all (struct reduct *reduct)
 Registers all Reduct intrinsics with the given Reduct instance.
 
void reduct_intrinsic_block_generic (struct reduct_compiler *compiler, struct reduct_item *list, reduct_uint32_t startIdx, struct reduct_expr *out)
 Compiles a block of expressions (like a do block).
 

Variables

reduct_intrinsic_handler_t reductIntrinsicHandlers [REDUCT_INTRINSIC_MAX]
 Intrinsic handler functions array.
 
reduct_native_fn reductIntrinsicNatives [REDUCT_INTRINSIC_MAX]
 Intrinsic native functions array.
 
const char * reductIntrinsics [REDUCT_INTRINSIC_MAX]
 Intrinsic names array.
 

Macro Definition Documentation

◆ REDUCT_INTRINSIC_NONE

#define REDUCT_INTRINSIC_NONE   0

None.

Definition at line 30 of file intrinsic.h.

◆ REDUCT_INTRINSIC_QUOTE

#define REDUCT_INTRINSIC_QUOTE   1

Quote.

Definition at line 31 of file intrinsic.h.

◆ REDUCT_INTRINSIC_LIST

#define REDUCT_INTRINSIC_LIST   2

List.

Definition at line 32 of file intrinsic.h.

◆ REDUCT_INTRINSIC_DO

#define REDUCT_INTRINSIC_DO   3

Do.

Definition at line 33 of file intrinsic.h.

◆ REDUCT_INTRINSIC_LAMBDA

#define REDUCT_INTRINSIC_LAMBDA   4

Lambda.

Definition at line 34 of file intrinsic.h.

◆ REDUCT_INTRINSIC_THREAD

#define REDUCT_INTRINSIC_THREAD   5

Thread.

Definition at line 35 of file intrinsic.h.

◆ REDUCT_INTRINSIC_DEF

#define REDUCT_INTRINSIC_DEF   6

Def.

Definition at line 36 of file intrinsic.h.

◆ REDUCT_INTRINSIC_IF

#define REDUCT_INTRINSIC_IF   7

If.

Definition at line 37 of file intrinsic.h.

◆ REDUCT_INTRINSIC_COND

#define REDUCT_INTRINSIC_COND   8

Cond.

Definition at line 38 of file intrinsic.h.

◆ REDUCT_INTRINSIC_MATCH

#define REDUCT_INTRINSIC_MATCH   9

Match.

Definition at line 39 of file intrinsic.h.

◆ REDUCT_INTRINSIC_AND

#define REDUCT_INTRINSIC_AND   10

And.

Definition at line 40 of file intrinsic.h.

◆ REDUCT_INTRINSIC_OR

#define REDUCT_INTRINSIC_OR   11

Or.

Definition at line 41 of file intrinsic.h.

◆ REDUCT_INTRINSIC_NOT

#define REDUCT_INTRINSIC_NOT   12

Not.

Definition at line 42 of file intrinsic.h.

◆ REDUCT_INTRINSIC_ADD

#define REDUCT_INTRINSIC_ADD   13

Add.

Definition at line 43 of file intrinsic.h.

◆ REDUCT_INTRINSIC_SUB

#define REDUCT_INTRINSIC_SUB   14

Sub.

Definition at line 44 of file intrinsic.h.

◆ REDUCT_INTRINSIC_MUL

#define REDUCT_INTRINSIC_MUL   15

Mul.

Definition at line 45 of file intrinsic.h.

◆ REDUCT_INTRINSIC_DIV

#define REDUCT_INTRINSIC_DIV   16

Div.

Definition at line 46 of file intrinsic.h.

◆ REDUCT_INTRINSIC_MOD

#define REDUCT_INTRINSIC_MOD   17

Mod.

Definition at line 47 of file intrinsic.h.

◆ REDUCT_INTRINSIC_INC

#define REDUCT_INTRINSIC_INC   18

Inc.

Definition at line 48 of file intrinsic.h.

◆ REDUCT_INTRINSIC_DEC

#define REDUCT_INTRINSIC_DEC   19

Dec.

Definition at line 49 of file intrinsic.h.

◆ REDUCT_INTRINSIC_BAND

#define REDUCT_INTRINSIC_BAND   20

Bitwise And.

Definition at line 50 of file intrinsic.h.

◆ REDUCT_INTRINSIC_BOR

#define REDUCT_INTRINSIC_BOR   21

Bitwise Or.

Definition at line 51 of file intrinsic.h.

◆ REDUCT_INTRINSIC_BXOR

#define REDUCT_INTRINSIC_BXOR   22

Bitwise Xor.

Definition at line 52 of file intrinsic.h.

◆ REDUCT_INTRINSIC_BNOT

#define REDUCT_INTRINSIC_BNOT   23

Bitwise Not.

Definition at line 53 of file intrinsic.h.

◆ REDUCT_INTRINSIC_SHL

#define REDUCT_INTRINSIC_SHL   24

Bitwise Shift Left.

Definition at line 54 of file intrinsic.h.

◆ REDUCT_INTRINSIC_SHR

#define REDUCT_INTRINSIC_SHR   25

Bitwise Shift Right.

Definition at line 55 of file intrinsic.h.

◆ REDUCT_INTRINSIC_EQ

#define REDUCT_INTRINSIC_EQ   26

Equal.

Definition at line 56 of file intrinsic.h.

◆ REDUCT_INTRINSIC_NEQ

#define REDUCT_INTRINSIC_NEQ   27

Not Equal.

Definition at line 57 of file intrinsic.h.

◆ REDUCT_INTRINSIC_SEQ

#define REDUCT_INTRINSIC_SEQ   28

Strict Equal.

Definition at line 58 of file intrinsic.h.

◆ REDUCT_INTRINSIC_SNEQ

#define REDUCT_INTRINSIC_SNEQ   29

Strict Not Equal.

Definition at line 59 of file intrinsic.h.

◆ REDUCT_INTRINSIC_LT

#define REDUCT_INTRINSIC_LT   30

Less.

Definition at line 60 of file intrinsic.h.

◆ REDUCT_INTRINSIC_LE

#define REDUCT_INTRINSIC_LE   31

Less Equal.

Definition at line 61 of file intrinsic.h.

◆ REDUCT_INTRINSIC_GT

#define REDUCT_INTRINSIC_GT   32

Greater.

Definition at line 62 of file intrinsic.h.

◆ REDUCT_INTRINSIC_GE

#define REDUCT_INTRINSIC_GE   33

Greater Equal.

Definition at line 63 of file intrinsic.h.

◆ REDUCT_INTRINSIC_MAX

#define REDUCT_INTRINSIC_MAX   34

The amount of intrinsics.

Definition at line 64 of file intrinsic.h.

Typedef Documentation

◆ reduct_intrinsic_t

Intrinsic types.

Definition at line 28 of file intrinsic.h.

◆ reduct_intrinsic_handler_t

typedef void( * reduct_intrinsic_handler_t) (struct reduct_compiler *compiler, struct reduct_item *expr, struct reduct_expr *out)

Intrinsic handler function type.

Definition at line 69 of file intrinsic.h.

Function Documentation

◆ reduct_intrinsic_register_all()

REDUCT_API void reduct_intrinsic_register_all ( struct reduct *  reduct)

Registers all Reduct intrinsics with the given Reduct instance.

Parameters
reductThe Reduct instance to register intrinsics with.
Here is the caller graph for this function:

◆ reduct_intrinsic_block_generic()

void reduct_intrinsic_block_generic ( struct reduct_compiler *  compiler,
struct reduct_item *  list,
reduct_uint32_t  startIdx,
struct reduct_expr *  out 
)

Compiles a block of expressions (like a do block).

Parameters
compilerThe compiler context.
listThe list containing the expressions.
startIdxThe index to start compiling from.
outThe output expression.
Here is the caller graph for this function:

Variable Documentation

◆ reductIntrinsicHandlers

reduct_intrinsic_handler_t reductIntrinsicHandlers[REDUCT_INTRINSIC_MAX]
extern

Intrinsic handler functions array.

Definition at line 1201 of file intrinsic_impl.h.

◆ reductIntrinsicNatives

reduct_native_fn reductIntrinsicNatives[REDUCT_INTRINSIC_MAX]
extern

Intrinsic native functions array.

Definition at line 1484 of file intrinsic_impl.h.

◆ reductIntrinsics

const char* reductIntrinsics[REDUCT_INTRINSIC_MAX]
extern

Intrinsic names array.

Definition at line 1243 of file intrinsic_impl.h.