Reduct  v4.0.5-1-g4851deb
A functional and immutable language.
Loading...
Searching...
No Matches
build.h
Go to the documentation of this file.
1#ifndef REDUCT_BUILD_H
2#define REDUCT_BUILD_H 1
3
4#include <reduct/defs.h>
5#include <reduct/function.h>
6#include <reduct/list.h>
7#include <reduct/native.h>
8#include <reduct/rvsdg.h>
9
10struct reduct;
11struct reduct_item;
12
13/**
14 * @file build.h
15 * @brief Intermediate Representation builder.
16 * @defgroup build Build
17 *
18 * The builder is responsible for converting parsed S-expressions (ASTs) into the intermediate representation (IR) used
19 * by the optimizer and compiler.
20 *
21 * @{
22 */
23
24/**
25 * @brief Build an IR graph from an AST (parsed S-expression).
26 *
27 * @param reduct Pointer to the Reduct structure.
28 * @param ast Handle to the root of the AST.
29 * @return Handle to the root IR node.
30 */
32
33/**
34 * @brief Register the intrinsics used by the builder.
35 *
36 * @note Will be called by `reduct_new()`.
37 *
38 * @param reduct Pointer to the Reduct structure.
39 */
40REDUCT_API void reduct_build_register_intrinsics(struct reduct* reduct);
41
42/**
43 * @brief Get the native function associated with an opcode.
44 *
45 * @param op The opcode.
46 * @return The native function, or NULL if not found.
47 */
49
50/** @} */
51
52#endif
reduct_handle_t(* reduct_native_fn)(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
Native function pointer type.
Definition defs.h:126
#define REDUCT_API
Definition defs.h:24
Compiled function.
REDUCT_API reduct_native_fn reduct_builder_get_native_fn(reduct_opcode_t op)
Get the native function associated with an opcode.
REDUCT_API void reduct_build_register_intrinsics(struct reduct *reduct)
Register the intrinsics used by the builder.
REDUCT_API reduct_handle_t reduct_build(struct reduct *reduct, reduct_handle_t ast)
Build an IR graph from an AST (parsed S-expression).
reduct_opcode_t
Opcode enumeration.
Definition opcode.h:50
List management.
Native function and intrinsic registration.
Intermediate Representation.
Handle type.
Definition defs.h:119