# API Reference

## Groups

| Name                                         | Description |
| -------------------------------------------- | ----------- |
| [`Debug Submodule`](Debug.md#debugsubmodule) |             |

## Classes

| Name                                  | Description                                                               |
| ------------------------------------- | ------------------------------------------------------------------------- |
| [`BP`](#bp)                           |                                                                           |
| [`Expr`](#expr-1)                     |                                                                           |
| [`Sema`](#sema)                       |                                                                           |
| [`Stmt`](#stmt-1)                     |                                                                           |
| [`Arena`](#arena)                     | Linear allocation arena.                                                  |
| [`Lexer`](#lexer)                     | Stateful lexer cursor over an input source buffer.                        |
| [`Param`](#param-1)                   |                                                                           |
| [`Token`](#token)                     |                                                                           |
| [`Parser`](#parser-2)                 | [Parser](#parser-2) state over a linked list of [Token](#token) pointers. |
| [`Symbol`](#symbol)                   |                                                                           |
| [`HashMap`](#hashmap-1)               |                                                                           |
| [`TypeExpr`](#typeexpr-1)             |                                                                           |
| [`JITModule`](#jitmodule-1)           | Mutable LLVM module tracked by the JIT context.                           |
| [`JITContext`](#jitcontext-1)         | Global JIT state for one runtime session.                                 |
| [`LinkedList`](#linkedlist-1)         |                                                                           |
| [`HashMapNode`](#hashmapnode-1)       |                                                                           |
| [`PassManager`](#passmanager-1)       | Owns the ordered pass pipeline and the state shared between its passes.   |
| [`SymbolTable`](#symboltable)         |                                                                           |
| [`LinkedListNode`](#linkedlistnode-1) |                                                                           |
| [`RockyCliParser`](#rockycliparser-1) |                                                                           |
| [`InputPassResult`](#inputpassresult) |                                                                           |
| [`LexerPassResult`](#lexerpassresult) |                                                                           |
| [`RockyCliOptions`](#rockyclioptions) |                                                                           |

## Macros

***

### MODULE\_NAME\_MAX

```cpp
#define MODULE_NAME_MAX 256
```

Defined in src/jit.c:13

***

### ROCKY\_CONTEXT\_CLI\_OPTIONS

```cpp
#define ROCKY_CONTEXT_CLI_OPTIONS "cli-options"
```

Defined in include/rocky/pass/pass.h:14

***

### ROCKY\_CONTEXT\_INPUT

```cpp
#define ROCKY_CONTEXT_INPUT "input"
```

Defined in include/rocky/pass/input.h:12

***

### ROCKY\_CONTEXT\_SOURCE

```cpp
#define ROCKY_CONTEXT_SOURCE "source"
```

Defined in include/rocky/pass/input.h:13

***

### PASS\_MANAGER\_ARENA\_CAPACITY

```cpp
#define PASS_MANAGER_ARENA_CAPACITY (256 * 1024)
```

Defined in src/pass/manager.c:12

***

### PASS\_MANAGER\_CONTEXT\_CAPACITY

```cpp
#define PASS_MANAGER_CONTEXT_CAPACITY 16
```

Defined in src/pass/manager.c:13

***

### TABLE\_MAX\_LOAD

```cpp
#define TABLE_MAX_LOAD 0.75
```

Defined in src/symtable.c:6

***

### GROW\_CAPACITY

```cpp
#define GROW_CAPACITY(cap) ((cap) < 8 ? 8 : (cap) * 2)
```

Defined in src/symtable.c:7

***

### ROCKY\_CONTEXT\_SEMA

```cpp
#define ROCKY_CONTEXT_SEMA "sema"
```

Defined in include/rocky/pass/sema.h:7

***

### ROCKY\_CONTEXT\_SYMBOL\_TABLE

```cpp
#define ROCKY_CONTEXT_SYMBOL_TABLE "symbol-table"
```

Defined in include/rocky/pass/sema.h:8

***

### ROCKY\_CONTEXT\_TOKENS

```cpp
#define ROCKY_CONTEXT_TOKENS "tokens"
```

Defined in include/rocky/pass/lexer.h:14

***

### LEXER\_PASS\_MAX\_TOKENS

```cpp
#define LEXER_PASS_MAX_TOKENS 4096
```

Defined in src/pass/lexer.c:12

***

### ROCKY\_CONTEXT\_AST

```cpp
#define ROCKY_CONTEXT_AST "ast"
```

Defined in include/rocky/pass/parser.h:7

## Enumerations

***

### RockyCliParseStatus

```cpp
enum RockyCliParseStatus
```

Defined in include/rocky/cli.h:20

| Value                   | Description |
| ----------------------- | ----------- |
| `ROCKY_CLI_PARSE_OK`    |             |
| `ROCKY_CLI_PARSE_HELP`  |             |
| `ROCKY_CLI_PARSE_ERROR` |             |

***

### TypeKind

```cpp
enum TypeKind
```

Defined in include/rocky/parser/ast.h:9

| Value        | Description |
| ------------ | ----------- |
| `TYPE_INT`   |             |
| `TYPE_FLOAT` |             |
| `TYPE_BOOL`  |             |
| `TYPE_VOID`  |             |

***

### UnaryOp

```cpp
enum UnaryOp
```

Defined in include/rocky/parser/ast.h:18

| Value           | Description |
| --------------- | ----------- |
| `UNOP_NEG`      |             |
| `UNOP_BITNOT`   |             |
| `UNOP_LOGICNOT` |             |

***

### BinaryOp

```cpp
enum BinaryOp
```

Defined in include/rocky/parser/ast.h:24

| Value        | Description |
| ------------ | ----------- |
| `BINOP_ADD`  |             |
| `BINOP_SUB`  |             |
| `BINOP_MUL`  |             |
| `BINOP_DIV`  |             |
| `BINOP_MOD`  |             |
| `BINOP_BAND` |             |
| `BINOP_BOR`  |             |
| `BINOP_BXOR` |             |
| `BINOP_SHL`  |             |
| `BINOP_SHR`  |             |
| `BINOP_EQ`   |             |
| `BINOP_NEQ`  |             |
| `BINOP_LT`   |             |
| `BINOP_GT`   |             |
| `BINOP_LE`   |             |
| `BINOP_GE`   |             |
| `BINOP_AND`  |             |
| `BINOP_OR`   |             |

***

### ExprKind

```cpp
enum ExprKind
```

Defined in include/rocky/parser/ast.h:49

| Value             | Description |
| ----------------- | ----------- |
| `EXPR_INT_LIT`    |             |
| `EXPR_FLOAT_LIT`  |             |
| `EXPR_BOOL_LIT`   |             |
| `EXPR_STRING_LIT` |             |
| `EXPR_IDENT`      |             |
| `EXPR_UNARY`      |             |
| `EXPR_BINARY`     |             |
| `EXPR_CAST`       |             |

***

### TokenPrintFlags

```cpp
enum TokenPrintFlags
```

Defined in include/rocky/debug.h:15

Bitmask controlling which token fields are printed.

| Value                   | Description |
| ----------------------- | ----------- |
| `TOK_PRINT_FLAG_KIND`   |             |
| `TOK_PRINT_FLAG_LEXEME` |             |
| `TOK_PRINT_FLAG_LINE`   |             |
| `TOK_PRINT_FLAG_COL`    |             |
| `TOK_PRINT_ALL`         |             |

***

### TokenKind

```cpp
enum TokenKind
```

Defined in include/rocky/lexer/token.h:6

| Value               | Description |
| ------------------- | ----------- |
| `TOKEN_TYPE_INT`    |             |
| `TOKEN_TYPE_FLOAT`  |             |
| `TOKEN_TYPE_STRING` |             |
| `TOKEN_TYPE_BOOL`   |             |
| `TOKEN_TYPE_SIZE_T` |             |
| `TOKEN_INT`         |             |
| `TOKEN_FLOAT`       |             |
| `TOKEN_STRING`      |             |
| `TOKEN_BOOL`        |             |
| `TOKEN_SIZE_T`      |             |
| `TOKEN_IDENTIFIER`  |             |
| `TOKEN_ELSE`        |             |
| `TOKEN_IF`          |             |
| `TOKEN_RETURN`      |             |
| `TOKEN_WHILE`       |             |
| `TOKEN_FALSE`       |             |
| `TOKEN_TRUE`        |             |
| `TOKEN_FOR`         |             |
| `TOKEN_BREAK`       |             |
| `TOKEN_CONTINUE`    |             |
| `TOKEN_FUNCTION`    |             |
| `TOKEN_PLUS`        |             |
| `TOKEN_MINUS`       |             |
| `TOKEN_STAR`        |             |
| `TOKEN_SLASH`       |             |
| `TOKEN_PERCENT`     |             |
| `TOKEN_EQUAL`       |             |
| `TOKEN_CARET`       |             |
| `TOKEN_PIPE`        |             |
| `TOKEN_AMP`         |             |
| `TOKEN_BANG`        |             |
| `TOKEN_EQEQ`        |             |
| `TOKEN_BANGEQ`      |             |
| `TOKEN_LT`          |             |
| `TOKEN_GT`          |             |
| `TOKEN_LTEQ`        |             |
| `TOKEN_GTEQ`        |             |
| `TOKEN_AMPAMP`      |             |
| `TOKEN_PIPEPIPE`    |             |
| `TOKEN_LSHIFT`      |             |
| `TOKEN_RSHIFT`      |             |
| `TOKEN_TILDE`       |             |
| `TOKEN_PLUS_PLUS`   |             |
| `TOKEN_MINUS_MINUS` |             |
| `TOKEN_PLUS_EQUAL`  |             |
| `TOKEN_MINUS_EQUAL` |             |
| `TOKEN_COMMA`       |             |
| `TOKEN_LPAREN`      |             |
| `TOKEN_RPAREN`      |             |
| `TOKEN_LBRACE`      |             |
| `TOKEN_RBRACE`      |             |
| `TOKEN_COLON`       |             |
| `TOKEN_SEMICOLON`   |             |
| `TOKEN_EOF`         |             |
| `TOKEN_INVALID`     |             |
| `TOKEN_ERROR`       |             |

***

### StmtKind

```cpp
enum StmtKind
```

Defined in include/rocky/parser/nodes.h:18

| Value              | Description |
| ------------------ | ----------- |
| `STMT_EXPR`        |             |
| `STMT_IF`          |             |
| `STMT_WHILE`       |             |
| `STMT_RETURN`      |             |
| `STMT_FOR`         |             |
| `STMT_BLOCK`       |             |
| `STMT_FUNC`        |             |
| `STMT_DECLARATION` |             |
| `STMT_ASSIGN`      |             |
| `STMT_CONTINUE`    |             |
| `STMT_BREAK`       |             |

***

### TypeExprKind

```cpp
enum TypeExprKind
```

Defined in include/rocky/parser/nodes.h:92

| Value               | Description |
| ------------------- | ----------- |
| `TYPE_PRIMITIVE`    |             |
| `TYPE_POINTER`      |             |
| `TYPE_FUNC_POINTER` |             |

## Typedefs

***

### RockyCliParser

```cpp
using RockyCliParser = struct RockyCliParser
```

Defined in include/rocky/cli.h:7

***

### VoidFunc

```cpp
using VoidFunc = void
```

Defined in include/rocky/jit.h:20

***

### JITModule

```cpp
using JITModule = struct JITModule
```

Defined in include/rocky/jit.h:22

***

### JITContext

```cpp
using JITContext = struct JITContext
```

Defined in include/rocky/jit.h:31

***

### Expr

```cpp
using Expr = struct Expr
```

Defined in include/rocky/parser/ast.h:47

***

### PassManager

```cpp
using PassManager = struct PassManager
```

Defined in include/rocky/pass/pass.h:10

***

### Pass

```cpp
using Pass = void(*
```

Defined in include/rocky/pass/pass.h:12

***

### Parser

```cpp
using Parser = struct Parser
```

Defined in include/rocky/parser/nodes.h:6

***

### Param

```cpp
using Param = struct Param
```

Defined in include/rocky/parser/nodes.h:8

***

### Stmt

```cpp
using Stmt = struct Stmt
```

Defined in include/rocky/parser/nodes.h:9

***

### TypeExpr

```cpp
using TypeExpr = struct TypeExpr
```

Defined in include/rocky/parser/nodes.h:10

***

### HashMapNode

```cpp
using HashMapNode = struct HashMapNode
```

Defined in include/rocky/adt/hashmap.h:10

***

### HashMap

```cpp
using HashMap = struct HashMap
```

Defined in include/rocky/adt/hashmap.h:16

***

### LinkedListNode

```cpp
using LinkedListNode = struct LinkedListNode
```

Defined in include/rocky/adt/linked\_list.h:12

***

### LinkedList

```cpp
using LinkedList = struct LinkedList
```

Defined in include/rocky/adt/linked\_list.h:13

***

### Parser

```cpp
using Parser = struct Parser
```

Defined in include/rocky/parser/parser.h:15

[Parser](#parser-2) state over a linked list of [Token](#token) pointers.

## Functions

***

### rocky\_cli\_options\_init

```cpp
void rocky_cli_options_init(RockyCliOptions * options)
```

Defined in include/rocky/cli.h:26

***

### rocky\_cli\_parse\_init

```cpp
RockyCliParser * rocky_cli_parse_init(RockyCliOptions * options)
```

Defined in include/rocky/cli.h:27

***

### rocky\_cli\_parser\_free

```cpp
void rocky_cli_parser_free(RockyCliParser * parser)
```

Defined in include/rocky/cli.h:28

***

### rocky\_cli\_parser\_add\_option

```cpp
int rocky_cli_parser_add_option(RockyCliParser * parser, const struct argparse_option * option)
```

Defined in include/rocky/cli.h:30

Copies a normal argparse option into the parser's option list.

***

### rocky\_cli\_parse

```cpp
RockyCliParseStatus rocky_cli_parse(RockyCliParser * parser, int argc, char ** argv, char * errbuf, size_t errbuf_size)
```

Defined in include/rocky/cli.h:31

***

### rocky\_cli\_print\_usage

```cpp
void rocky_cli_print_usage(FILE * out, const char * program_name)
```

Defined in include/rocky/cli.h:33

***

### jit\_init

```cpp
void jit_init(JITContext * ctx)
```

Defined in include/rocky/jit.h:51

Initializes a JIT context and ORC engine.

Initializes a JIT context and ORC engine.

Initializes a JIT context and ORC engine.

Initializes a JIT context and ORC engine.

***

### jit\_free

```cpp
void jit_free(JITContext * ctx)
```

Defined in include/rocky/jit.h:53

Releases all JIT resources.

Releases all JIT resources.

Releases all JIT resources.

Releases all JIT resources.

***

### jit\_add\_dummy\_functions

```cpp
void jit_add_dummy_functions(JITContext * ctx)
```

Defined in include/rocky/jit.h:55

Adds temporary/demo functions to current mutable module.

Adds temporary/demo functions to current mutable module.

Adds temporary/demo functions to current mutable module.

Adds temporary/demo functions to current mutable module.

***

### jit\_bake

```cpp
void jit_bake(JITContext * ctx)
```

Defined in include/rocky/jit.h:57

Finalizes and submits current module to the JIT.

Finalizes and submits current module to the JIT.

Finalizes and submits current module to the JIT.

Finalizes and submits current module to the JIT.

***

### jit\_lookup\_function

```cpp
VoidFunc * jit_lookup_function(JITContext * ctx, char * function_name)
```

Defined in include/rocky/jit.h:59

Resolves a JIT function by symbol name.

Resolves a JIT function by symbol name.

Resolves a JIT function by symbol name.

Resolves a JIT function by symbol name.

***

### write\_err

`static`

```cpp
static void write_err(char * errbuf, size_t errbuf_size, const char * message)
```

Defined in src/cli.c:25

***

### rocky\_cli\_options\_init

```cpp
void rocky_cli_options_init(RockyCliOptions * options)
```

Defined in src/cli.c:31

***

### rocky\_cli\_parser\_add\_option

```cpp
int rocky_cli_parser_add_option(RockyCliParser * parser, const struct argparse_option * option)
```

Defined in src/cli.c:44

Copies a normal argparse option into the parser's option list.

***

### rocky\_cli\_parse\_init

```cpp
RockyCliParser * rocky_cli_parse_init(RockyCliOptions * options)
```

Defined in src/cli.c:64

***

### rocky\_cli\_parser\_free

```cpp
void rocky_cli_parser_free(RockyCliParser * parser)
```

Defined in src/cli.c:93

***

### rocky\_cli\_print\_usage

```cpp
void rocky_cli_print_usage(FILE * out, const char * program_name)
```

Defined in src/cli.c:101

***

### rocky\_cli\_parse

```cpp
RockyCliParseStatus rocky_cli_parse(RockyCliParser * parser, int argc, char ** argv, char * errbuf, size_t errbuf_size)
```

Defined in src/cli.c:107

***

### jit\_verify\_module\_mutable

`static`

```cpp
static void jit_verify_module_mutable(JITContext * ctx)
```

Defined in src/jit.c:15

***

### jit\_error\_report

```cpp
void jit_error_report(void * ctx, LLVMErrorRef err)
```

Defined in src/jit.c:35

ORC error callback used by execution session.

#### Parameters

| Parameter | Type           | Description                     |
| --------- | -------------- | ------------------------------- |
| `ctx`     | `void *`       | User callback context (unused). |
| `err`     | `LLVMErrorRef` | LLVM error object.              |

***

### jit\_init

```cpp
void jit_init(JITContext * ctx)
```

Defined in src/jit.c:41

Initializes a JIT context and ORC engine.

Initializes a JIT context and ORC engine.

Initializes a JIT context and ORC engine.

Initializes a JIT context and ORC engine.

***

### jit\_add\_dummy\_functions

```cpp
void jit_add_dummy_functions(JITContext * ctx)
```

Defined in src/jit.c:71

Adds temporary/demo functions to current mutable module.

Adds temporary/demo functions to current mutable module.

Adds temporary/demo functions to current mutable module.

Adds temporary/demo functions to current mutable module.

***

### jit\_bake

```cpp
void jit_bake(JITContext * ctx)
```

Defined in src/jit.c:102

Finalizes and submits current module to the JIT.

Finalizes and submits current module to the JIT.

Finalizes and submits current module to the JIT.

Finalizes and submits current module to the JIT.

***

### jit\_lookup\_function

```cpp
VoidFunc * jit_lookup_function(JITContext * ctx, char * function_name)
```

Defined in src/jit.c:108

Resolves a JIT function by symbol name.

Resolves a JIT function by symbol name.

Resolves a JIT function by symbol name.

Resolves a JIT function by symbol name.

***

### jit\_free

```cpp
void jit_free(JITContext * ctx)
```

Defined in src/jit.c:115

Releases all JIT resources.

Releases all JIT resources.

Releases all JIT resources.

Releases all JIT resources.

***

### main

```cpp
int main(int argc, char ** argv)
```

Defined in src/main.c:18

***

### visit\_stmt

`static`

```cpp
static void visit_stmt(Sema * sema, Stmt * stmt)
```

Defined in src/sema.c:30

***

### visit\_expr

`static`

```cpp
static void visit_expr(Sema * sema, Expr * expr)
```

Defined in src/sema.c:123

***

### visit\_declaration

`static`

```cpp
static void visit_declaration(Sema * sema, Stmt * stmt)
```

Defined in src/sema.c:166

***

### init\_sema

```cpp
void init_sema(Sema * sema)
```

Defined in src/sema.c:13

***

### free\_sema

```cpp
void free_sema(Sema * sema)
```

Defined in src/sema.c:18

***

### visit\_stmt\_list

`static`

```cpp
static void visit_stmt_list(Sema * sema, Stmt * stmt)
```

Defined in src/sema.c:22

***

### sema\_check

```cpp
bool sema_check(Sema * sema, Stmt * program)
```

Defined in src/sema.c:178

***

### arena\_alloc

`static` `inline`

```cpp
static inline void * arena_alloc(Arena * a, size_t size)
```

Defined in include/rocky/arena.h:43

Allocates aligned memory from the arena.

#### Returns

Pointer to allocated storage inside the arena.

#### Parameters

| Parameter | Type                 | Description                       |
| --------- | -------------------- | --------------------------------- |
| `a`       | [`Arena`](#arena) \* | [Arena](#arena) to allocate from. |
| `size`    | `size_t`             | Requested byte size.              |

***

### token\_type\_str

```cpp
const char * token_type_str(TokenKind type)
```

Defined in include/rocky/debug.h:24

Converts token kind to display string.

Converts token kind to display string.

Converts token kind to display string.

Converts token kind to display string.

***

### unary\_op\_str

```cpp
const char * unary_op_str(UnaryOp op)
```

Defined in include/rocky/debug.h:27

Converts unary operator to display string.

Converts unary operator to display string.

Converts unary operator to display string.

Converts unary operator to display string.

***

### datatype\_str

```cpp
const char * datatype_str(TypeKind t)
```

Defined in include/rocky/debug.h:30

Converts type kind to display string.

Converts type kind to display string.

Converts type kind to display string.

Converts type kind to display string.

***

### binary\_op\_str

```cpp
const char * binary_op_str(BinaryOp op)
```

Defined in include/rocky/debug.h:33

Converts binary operator to display string.

Converts binary operator to display string.

Converts binary operator to display string.

Converts binary operator to display string.

***

### stmt\_kind\_str

```cpp
const char * stmt_kind_str(StmtKind kind)
```

Defined in include/rocky/debug.h:52

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

***

### alloc\_param

```cpp
Param * alloc_param(Parser * p, Token name, TypeExpr * type)
```

Defined in include/rocky/parser/nodes.h:114

***

### alloc\_stmt

```cpp
Stmt * alloc_stmt(Parser * p, StmtKind kind, Token tok)
```

Defined in include/rocky/parser/nodes.h:115

***

### alloc\_type\_expr

```cpp
TypeExpr * alloc_type_expr(Parser * p, TypeExprKind kind)
```

Defined in include/rocky/parser/nodes.h:116

***

### input\_pass\_register\_cli\_flags

```cpp
void input_pass_register_cli_flags(RockyCliParser * parser, RockyCliOptions * options)
```

Defined in include/rocky/pass/input.h:15

***

### input\_pass

```cpp
void input_pass(PassManager * pm)
```

Defined in include/rocky/pass/input.h:16

***

### use\_color

`static`

```cpp
static int use_color(void)
```

Defined in src/debug.c:26

***

### datatype\_str

```cpp
const char * datatype_str(TypeKind t)
```

Defined in src/debug.c:189

Converts type kind to display string.

Converts type kind to display string.

Converts type kind to display string.

Converts type kind to display string.

***

### stmt\_kind\_str

```cpp
const char * stmt_kind_str(StmtKind kind)
```

Defined in src/debug.c:258

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

Converts a statement kind to a human-readable display string.

***

### print\_tree\_prefix

`static`

```cpp
static void print_tree_prefix(int depth, int is_last, int sibling)
```

Defined in src/debug.c:287

***

### print\_type\_expr

`static`

```cpp
static void print_type_expr(const TypeExpr * type)
```

Defined in src/debug.c:296

***

### print\_children

```cpp
void print_children(const Expr ** children, int count, int depth, int sibling)
```

Defined in src/debug.c:347

Recursively prints a list of child expressions in tree form.

***

### print\_stmt\_child

`static`

```cpp
static void print_stmt_child(const Stmt * stmt, int depth, int is_last, int sibling)
```

Defined in src/debug.c:416

***

### print\_expr\_child

`static`

```cpp
static void print_expr_child(const Expr * expr, int depth, int is_last, int sibling)
```

Defined in src/debug.c:420

***

### print\_stmt\_node

`static`

```cpp
static void print_stmt_node(const Stmt * stmt, int depth, int is_last, int sibling)
```

Defined in src/debug.c:424

***

### is\_at\_end

`static`

```cpp
static bool is_at_end(Lexer * lexer)
```

Defined in src/lexer.c:19

***

### lexer\_advance

`static`

```cpp
static char lexer_advance(Lexer * lexer)
```

Defined in src/lexer.c:24

***

### peek

`static`

```cpp
static char peek(Lexer * lexer)
```

Defined in src/lexer.c:36

***

### peek\_next

`static`

```cpp
static char peek_next(Lexer * lexer)
```

Defined in src/lexer.c:41

***

### skip\_whitespace

`static`

```cpp
static void skip_whitespace(Lexer * lexer)
```

Defined in src/lexer.c:48

***

### make\_token

`static`

```cpp
static Token make_token(Lexer * lexer, TokenKind type)
```

Defined in src/lexer.c:79

***

### error\_token

`static`

```cpp
static Token error_token(Lexer * lexer, const char * message)
```

Defined in src/lexer.c:91

***

### match

`static`

```cpp
static bool match(Lexer * lexer, char expected)
```

Defined in src/lexer.c:101

***

### string

`static`

```cpp
static Token string(Lexer * lexer)
```

Defined in src/lexer.c:111

***

### number

`static`

```cpp
static Token number(Lexer * lexer)
```

Defined in src/lexer.c:126

***

### check\_keyword

`static`

```cpp
static TokenKind check_keyword(Lexer * lexer, int start, int length, const char * rest, TokenKind type)
```

Defined in src/lexer.c:143

***

### identifier\_type

`static`

```cpp
static TokenKind identifier_type(Lexer * lexer)
```

Defined in src/lexer.c:153

***

### identifier

`static`

```cpp
static Token identifier(Lexer * lexer)
```

Defined in src/lexer.c:214

***

### count\_inline\_code

`static`

```cpp
static int count_inline_code(struct argparse * parser, const struct argparse_option * option)
```

Defined in src/pass/input.c:11

***

### input\_pass\_register\_cli\_flags

```cpp
void input_pass_register_cli_flags(RockyCliParser * parser, RockyCliOptions * options)
```

Defined in src/pass/input.c:18

***

### read\_file

`static`

```cpp
static char * read_file(const char * path)
```

Defined in src/pass/input.c:25

***

### input\_pass

```cpp
void input_pass(PassManager * pm)
```

Defined in src/pass/input.c:51

***

### parse\_stmt

```cpp
Stmt * parse_stmt(Parser * p)
```

Defined in src/parser.c:524

***

### parse\_variable\_declaration

```cpp
Stmt * parse_variable_declaration(Parser * p)
```

Defined in src/parser.c:490

***

### alloc\_stmt

```cpp
Stmt * alloc_stmt(Parser * p, StmtKind kind, Token tok)
```

Defined in src/parser.c:16

***

### alloc\_param

```cpp
Param * alloc_param(Parser * p, Token name, TypeExpr * type)
```

Defined in src/parser.c:24

***

### alloc\_type\_expr

```cpp
TypeExpr * alloc_type_expr(Parser * p, TypeExprKind kind)
```

Defined in src/parser.c:33

***

### alloc\_expr

`static`

```cpp
static Expr * alloc_expr(Parser * p, ExprKind kind, Token tok)
```

Defined in src/parser.c:40

***

### token\_at

`static`

```cpp
static Token token_at(const Parser * p, int index)
```

Defined in src/parser.c:51

***

### peek

`static`

```cpp
static Token peek(const Parser * p)
```

Defined in src/parser.c:61

***

### advance

`static`

```cpp
static Token advance(Parser * p)
```

Defined in src/parser.c:65

***

### expect

`static`

```cpp
static Token expect(Parser * p, TokenKind kind)
```

Defined in src/parser.c:72

***

### error

```cpp
void error(Token tok)
```

Defined in src/parser.c:84

***

### infix\_bp

`static`

```cpp
static BP infix_bp(TokenKind k)
```

Defined in src/parser.c:99

***

### prefix\_bp

`static`

```cpp
static int prefix_bp(TokenKind k)
```

Defined in src/parser.c:134

***

### tok\_to\_unop

`static`

```cpp
static UnaryOp tok_to_unop(TokenKind k)
```

Defined in src/parser.c:147

***

### tok\_to\_binop

`static`

```cpp
static BinaryOp tok_to_binop(TokenKind k)
```

Defined in src/parser.c:160

***

### parser\_init

```cpp
void parser_init(Parser * p, LinkedList * tokens, Arena * arena)
```

Defined in src/parser.c:205

***

### parse\_expr

```cpp
Expr * parse_expr(Parser * p, int min_bp)
```

Defined in src/parser.c:211

***

### parse\_type\_expr

```cpp
TypeExpr * parse_type_expr(Parser * p)
```

Defined in src/parser.c:287

***

### parse\_variable\_assignment

```cpp
Stmt * parse_variable_assignment(Parser * p)
```

Defined in src/parser.c:315

***

### parse\_variable\_assignment\_without\_semicolon

```cpp
Stmt * parse_variable_assignment_without_semicolon(Parser * p)
```

Defined in src/parser.c:327

***

### parse\_expr\_stmt

```cpp
Stmt * parse_expr_stmt(Parser * p)
```

Defined in src/parser.c:338

***

### parse\_block

```cpp
Stmt * parse_block(Parser * p)
```

Defined in src/parser.c:363

***

### parse\_params

```cpp
Param * parse_params(Parser * p)
```

Defined in src/parser.c:382

***

### parse\_while

```cpp
Stmt * parse_while(Parser * p)
```

Defined in src/parser.c:414

***

### parse\_for

```cpp
Stmt * parse_for(Parser * p)
```

Defined in src/parser.c:427

***

### parse\_return

```cpp
Stmt * parse_return(Parser * p)
```

Defined in src/parser.c:449

***

### parse\_if

```cpp
Stmt * parse_if(Parser * p)
```

Defined in src/parser.c:458

***

### parse\_continue

```cpp
Stmt * parse_continue(Parser * p)
```

Defined in src/parser.c:477

***

### parse\_break

```cpp
Stmt * parse_break(Parser * p)
```

Defined in src/parser.c:484

***

### parse\_func

```cpp
Stmt * parse_func(Parser * p)
```

Defined in src/parser.c:504

***

### parse\_top\_level

```cpp
Stmt * parse_top_level(Parser * p)
```

Defined in src/parser.c:559

***

### parse\_program

```cpp
Stmt * parse_program(Parser * p)
```

Defined in src/parser.c:576

***

### create\_hashmap

```cpp
HashMap * create_hashmap(int capacity)
```

Defined in include/rocky/adt/hashmap.h:19

***

### free\_hashmap

```cpp
void free_hashmap(HashMap * map)
```

Defined in include/rocky/adt/hashmap.h:23

***

### hashmap\_get

```cpp
void * hashmap_get(HashMap * map, const char * key)
```

Defined in include/rocky/adt/hashmap.h:28

***

### hashmap\_contains

```cpp
int hashmap_contains(HashMap * map, const char * key)
```

Defined in include/rocky/adt/hashmap.h:31

***

### hashmap\_set

```cpp
void hashmap_set(HashMap * map, const char * key, void * value)
```

Defined in include/rocky/adt/hashmap.h:34

***

### hashmap\_delete

```cpp
void * hashmap_delete(HashMap * map, const char * key)
```

Defined in include/rocky/adt/hashmap.h:37

***

### create\_pass\_manager

```cpp
PassManager * create_pass_manager(void)
```

Defined in include/rocky/pass/manager.h:30

Creates an empty pass manager. Returns NULL when allocation fails.

***

### free\_pass\_manager

```cpp
void free_pass_manager(PassManager * pm)
```

Defined in include/rocky/pass/manager.h:33

Releases manager-owned storage. Context keys and values are not freed.

***

### add\_pass

```cpp
void add_pass(PassManager * pm, Pass pass)
```

Defined in include/rocky/pass/manager.h:36

Appends a pass to the pipeline.

***

### remove\_pass

```cpp
void remove_pass(PassManager * pm, size_t index)
```

Defined in include/rocky/pass/manager.h:39

Removes the pass at index. Invalid indices are ignored.

***

### insert\_pass

```cpp
void insert_pass(PassManager * pm, Pass pass, size_t index)
```

Defined in include/rocky/pass/manager.h:42

Inserts a pass before index. An index equal to pass\_count appends it.

***

### run\_passes

```cpp
void run_passes(PassManager * pm)
```

Defined in include/rocky/pass/manager.h:45

Runs all registered passes in order.

***

### hashmap\_hash

`static`

```cpp
static unsigned long hashmap_hash(const char * str)
```

Defined in src/hashmap.c:10

***

### create\_hashmap

```cpp
HashMap * create_hashmap(int capacity)
```

Defined in src/hashmap.c:19

***

### free\_hashmap

```cpp
void free_hashmap(HashMap * map)
```

Defined in src/hashmap.c:51

***

### hashmap\_get

```cpp
void * hashmap_get(HashMap * map, const char * key)
```

Defined in src/hashmap.c:78

***

### hashmap\_contains

```cpp
int hashmap_contains(HashMap * map, const char * key)
```

Defined in src/hashmap.c:108

***

### hashmap\_set

```cpp
void hashmap_set(HashMap * map, const char * key, void * value)
```

Defined in src/hashmap.c:136

***

### hashmap\_delete

```cpp
void * hashmap_delete(HashMap * map, const char * key)
```

Defined in src/hashmap.c:181

***

### reserve\_passes

`static`

```cpp
static int reserve_passes(PassManager * pm, size_t required)
```

Defined in src/pass/manager.c:15

***

### create\_pass\_manager

```cpp
PassManager * create_pass_manager(void)
```

Defined in src/pass/manager.c:35

Creates an empty pass manager. Returns NULL when allocation fails.

***

### free\_pass\_manager

```cpp
void free_pass_manager(PassManager * pm)
```

Defined in src/pass/manager.c:57

Releases manager-owned storage. Context keys and values are not freed.

***

### add\_pass

```cpp
void add_pass(PassManager * pm, Pass pass)
```

Defined in src/pass/manager.c:68

Appends a pass to the pipeline.

***

### remove\_pass

```cpp
void remove_pass(PassManager * pm, size_t index)
```

Defined in src/pass/manager.c:75

Removes the pass at index. Invalid indices are ignored.

***

### insert\_pass

```cpp
void insert_pass(PassManager * pm, Pass pass, size_t index)
```

Defined in src/pass/manager.c:87

Inserts a pass before index. An index equal to pass\_count appends it.

***

### run\_passes

```cpp
void run_passes(PassManager * pm)
```

Defined in src/pass/manager.c:100

Runs all registered passes in order.

***

### init\_sym\_table

```cpp
void init_sym_table(SymbolTable * table)
```

Defined in include/rocky/parser/sema/symtable.h:26

***

### free\_sym\_table

```cpp
void free_sym_table(SymbolTable * table)
```

Defined in include/rocky/parser/sema/symtable.h:27

***

### begin\_scope

```cpp
void begin_scope(SymbolTable * table)
```

Defined in include/rocky/parser/sema/symtable.h:28

***

### end\_scope

```cpp
void end_scope(SymbolTable * table)
```

Defined in include/rocky/parser/sema/symtable.h:29

***

### declare\_symbol

```cpp
bool declare_symbol(SymbolTable * table, const char * name, int length, TypeExpr * type)
```

Defined in include/rocky/parser/sema/symtable.h:30

***

### resolve\_symbol

```cpp
Symbol * resolve_symbol(SymbolTable * table, const char * name, int length)
```

Defined in include/rocky/parser/sema/symtable.h:31

***

### dump\_symbol\_table

```cpp
void dump_symbol_table(SymbolTable * table)
```

Defined in include/rocky/parser/sema/symtable.h:32

***

### hash\_string

`static`

```cpp
static uint32_t hash_string(const char * name, int length)
```

Defined in src/symtable.c:10

***

### find\_entry

`static`

```cpp
static Symbol * find_entry(Symbol * symbols, int capacity, const char * name, int length)
```

Defined in src/symtable.c:23

***

### init\_sym\_table

```cpp
void init_sym_table(SymbolTable * table)
```

Defined in src/symtable.c:50

***

### free\_sym\_table

```cpp
void free_sym_table(SymbolTable * table)
```

Defined in src/symtable.c:57

***

### begin\_scope

```cpp
void begin_scope(SymbolTable * table)
```

Defined in src/symtable.c:62

***

### end\_scope

```cpp
void end_scope(SymbolTable * table)
```

Defined in src/symtable.c:66

***

### adjust\_capacity

`static`

```cpp
static void adjust_capacity(SymbolTable * table, int capacity)
```

Defined in src/symtable.c:78

***

### declare\_symbol

```cpp
bool declare_symbol(SymbolTable * table, const char * name, int length, TypeExpr * type)
```

Defined in src/symtable.c:114

***

### resolve\_symbol

```cpp
Symbol * resolve_symbol(SymbolTable * table, const char * name, int length)
```

Defined in src/symtable.c:142

***

### dump\_symbol\_table

```cpp
void dump_symbol_table(SymbolTable * table)
```

Defined in src/symtable.c:153

***

### sema\_pass\_register\_cli\_flags

```cpp
void sema_pass_register_cli_flags(RockyCliParser * parser, RockyCliOptions * options)
```

Defined in include/rocky/pass/sema.h:10

***

### sema\_pass

```cpp
void sema_pass(PassManager * pm)
```

Defined in include/rocky/pass/sema.h:11

***

### sema\_pass\_register\_cli\_flags

```cpp
void sema_pass_register_cli_flags(RockyCliParser * parser, RockyCliOptions * options)
```

Defined in src/pass/sema.c:10

***

### sema\_pass

```cpp
void sema_pass(PassManager * pm)
```

Defined in src/pass/sema.c:17

***

### lexer\_pass\_register\_cli\_flags

```cpp
void lexer_pass_register_cli_flags(RockyCliParser * parser, RockyCliOptions * options)
```

Defined in include/rocky/pass/lexer.h:16

***

### lexer\_pass

```cpp
void lexer_pass(PassManager * pm)
```

Defined in include/rocky/pass/lexer.h:17

***

### lexer\_pass\_register\_cli\_flags

```cpp
void lexer_pass_register_cli_flags(RockyCliParser * parser, RockyCliOptions * options)
```

Defined in src/pass/lexer.c:14

***

### lexer\_pass

```cpp
void lexer_pass(PassManager * pm)
```

Defined in src/pass/lexer.c:20

***

### create\_linked\_list

```cpp
LinkedList * create_linked_list(void)
```

Defined in include/rocky/adt/linked\_list.h:25

***

### free\_linked\_list

```cpp
void free_linked_list(LinkedList * ll)
```

Defined in include/rocky/adt/linked\_list.h:26

***

### linked\_list\_get

```cpp
void * linked_list_get(LinkedList * ll, int index)
```

Defined in include/rocky/adt/linked\_list.h:27

***

### linked\_list\_append

```cpp
void linked_list_append(LinkedList * ll, void * data)
```

Defined in include/rocky/adt/linked\_list.h:28

***

### linked\_list\_insert

```cpp
void linked_list_insert(LinkedList * ll, void * data, int index)
```

Defined in include/rocky/adt/linked\_list.h:29

***

### linked\_list\_pop

```cpp
void * linked_list_pop(LinkedList * ll)
```

Defined in include/rocky/adt/linked\_list.h:30

***

### linked\_list\_delete

```cpp
void * linked_list_delete(LinkedList * ll, int index)
```

Defined in include/rocky/adt/linked\_list.h:31

***

### parser\_pass\_register\_cli\_flags

```cpp
void parser_pass_register_cli_flags(RockyCliParser * parser, RockyCliOptions * options)
```

Defined in include/rocky/pass/parser.h:9

***

### parser\_pass

```cpp
void parser_pass(PassManager * pm)
```

Defined in include/rocky/pass/parser.h:10

***

### node\_at

`static`

```cpp
static LinkedListNode * node_at(LinkedList * ll, int index)
```

Defined in src/adt/linked\_list.c:11

***

### create\_linked\_list

```cpp
LinkedList * create_linked_list(void)
```

Defined in src/adt/linked\_list.c:23

***

### free\_linked\_list

```cpp
void free_linked_list(LinkedList * ll)
```

Defined in src/adt/linked\_list.c:33

***

### linked\_list\_get

```cpp
void * linked_list_get(LinkedList * ll, int index)
```

Defined in src/adt/linked\_list.c:48

***

### linked\_list\_append

```cpp
void linked_list_append(LinkedList * ll, void * data)
```

Defined in src/adt/linked\_list.c:56

***

### linked\_list\_insert

```cpp
void linked_list_insert(LinkedList * ll, void * data, int index)
```

Defined in src/adt/linked\_list.c:80

***

### linked\_list\_pop

```cpp
void * linked_list_pop(LinkedList * ll)
```

Defined in src/adt/linked\_list.c:102

***

### linked\_list\_delete

```cpp
void * linked_list_delete(LinkedList * ll, int index)
```

Defined in src/adt/linked\_list.c:109

***

### parser\_pass\_register\_cli\_flags

```cpp
void parser_pass_register_cli_flags(RockyCliParser * cli_parser, RockyCliOptions * options)
```

Defined in src/pass/parser.c:10

***

### parser\_pass

```cpp
void parser_pass(PassManager * pm)
```

Defined in src/pass/parser.c:16

***

### parser\_init

```cpp
void parser_init(Parser * p, LinkedList * tokens, Arena * arena)
```

Defined in include/rocky/parser/parser.h:17

***

### parse\_expr

```cpp
Expr * parse_expr(Parser * p, int min_bp)
```

Defined in include/rocky/parser/parser.h:18

***

### parse\_program

```cpp
Stmt * parse_program(Parser * p)
```

Defined in include/rocky/parser/parser.h:19

***

### init\_sema

```cpp
void init_sema(Sema * sema)
```

Defined in include/rocky/parser/sema/sema.h:14

***

### free\_sema

```cpp
void free_sema(Sema * sema)
```

Defined in include/rocky/parser/sema/sema.h:15

***

### sema\_check

```cpp
bool sema_check(Sema * sema, Stmt * program)
```

Defined in include/rocky/parser/sema/sema.h:16

## Variables

***

### ROCKY\_CLI\_USAGES

`static`

```cpp
const char *const ROCKY_CLI_USAGES[]
```

Defined in src/cli.c:19

## Class Definitions

### BP

```cpp
struct BP
```

Defined in src/parser.c:94

### Expr

```cpp
struct Expr
```

Defined in include/rocky/parser/ast.h:61

### Sema

```cpp
struct Sema
```

Defined in include/rocky/parser/sema/sema.h:9

### Stmt

```cpp
struct Stmt
```

Defined in include/rocky/parser/nodes.h:32

### Arena

```cpp
#include <arena.h>
```

```cpp
struct Arena
```

Defined in include/rocky/arena.h:17

Linear allocation arena.

### Lexer

```cpp
#include <lexer.h>
```

```cpp
struct Lexer
```

Defined in include/rocky/lexer/lexer.h:14

Stateful lexer cursor over an input source buffer.

### Param

```cpp
struct Param
```

Defined in include/rocky/parser/nodes.h:12

### Token

```cpp
struct Token
```

Defined in include/rocky/lexer/token.h:77

### Parser

```cpp
#include <parser.h>
```

```cpp
struct Parser
```

Defined in include/rocky/parser/parser.h:10

[Parser](#parser-2) state over a linked list of [Token](#token) pointers.

### Symbol

```cpp
struct Symbol
```

Defined in include/rocky/parser/sema/symtable.h:9

### HashMap

```cpp
struct HashMap
```

Defined in include/rocky/adt/hashmap.h:12

### TypeExpr

```cpp
struct TypeExpr
```

Defined in include/rocky/parser/nodes.h:98

### JITModule

```cpp
#include <jit.h>
```

```cpp
struct JITModule
```

Defined in include/rocky/jit.h:24

Mutable LLVM module tracked by the JIT context.

### JITContext

```cpp
#include <jit.h>
```

```cpp
struct JITContext
```

Defined in include/rocky/jit.h:33

Global JIT state for one runtime session.

### LinkedList

```cpp
struct LinkedList
```

Defined in include/rocky/adt/linked\_list.h:20

### HashMapNode

```cpp
struct HashMapNode
```

Defined in include/rocky/adt/hashmap.h:6

### PassManager

```cpp
#include <manager.h>
```

```cpp
struct PassManager
```

Defined in include/rocky/pass/manager.h:21

Owns the ordered pass pipeline and the state shared between its passes.

Values placed in context are owned by their producer. The manager owns neither those values nor their keys; allocations intended to live for the whole pipeline should be made with arena.

### SymbolTable

```cpp
struct SymbolTable
```

Defined in include/rocky/parser/sema/symtable.h:18

### LinkedListNode

```cpp
struct LinkedListNode
```

Defined in include/rocky/adt/linked\_list.h:15

### RockyCliParser

```cpp
struct RockyCliParser
```

Defined in src/cli.c:11

### InputPassResult

```cpp
struct InputPassResult
```

Defined in include/rocky/pass/input.h:7

### LexerPassResult

```cpp
struct LexerPassResult
```

Defined in include/rocky/pass/lexer.h:8

### RockyCliOptions

```cpp
struct RockyCliOptions
```

Defined in include/rocky/cli.h:10

Generated by [Moxygen](https://0state.com/moxygen)
