Cthulhu  0.2.10
Cthulhu compiler collection
ast.c File Reference
#include "ctu/ast.h"
#include "std/vector.h"
#include "arena/arena.h"
#include "cthulhu/broker/scan.h"
Include dependency graph for ast.c:

Go to the source code of this file.

Functions

ctu_tctu_module (scan_t *scan, where_t where, const vector_t *modspec, const vector_t *imports, const vector_t *decls)
 
ctu_tctu_import (scan_t *scan, where_t where, vector_t *path, char *name)
 
ctu_tctu_attrib (scan_t *scan, where_t where, const vector_t *path, const vector_t *args)
 
ctu_tctu_apply (ctu_t *decl, const vector_t *attribs)
 
ctu_tctu_stmt_list (scan_t *scan, where_t where, vector_t *stmts)
 
ctu_tctu_stmt_local (scan_t *scan, where_t where, bool mutable, char *name, ctu_t *type, ctu_t *value)
 
ctu_tctu_stmt_return (scan_t *scan, where_t where, ctu_t *value)
 
ctu_tctu_stmt_while (scan_t *scan, where_t where, char *name, ctu_t *cond, ctu_t *then, ctu_t *other)
 
ctu_tctu_stmt_assign (scan_t *scan, where_t where, ctu_t *dst, ctu_t *src)
 
ctu_tctu_stmt_break (scan_t *scan, where_t where, char *label)
 
ctu_tctu_stmt_continue (scan_t *scan, where_t where, char *label)
 
ctu_tctu_stmt_branch (scan_t *scan, where_t where, ctu_t *cond, ctu_t *then, ctu_t *other)
 
ctu_tctu_expr_int (scan_t *scan, where_t where, ctu_integer_t value)
 
ctu_tctu_expr_bool (scan_t *scan, where_t where, bool value)
 
ctu_tctu_expr_string (scan_t *scan, where_t where, char *text, size_t length)
 
ctu_tctu_expr_char (scan_t *scan, where_t where, char *text, size_t length)
 
ctu_tctu_expr_init (scan_t *scan, where_t where, const vector_t *inits)
 
ctu_tctu_expr_call (scan_t *scan, where_t where, ctu_t *callee, const vector_t *args)
 
ctu_tctu_expr_name (scan_t *scan, where_t where, const vector_t *path)
 
ctu_tctu_expr_cast (scan_t *scan, where_t where, ctu_t *expr, ctu_t *type)
 
ctu_tctu_expr_ref (scan_t *scan, where_t where, ctu_t *expr)
 
ctu_tctu_expr_deref (scan_t *scan, where_t where, ctu_t *expr)
 
ctu_tctu_expr_index (scan_t *scan, where_t where, ctu_t *expr, ctu_t *index)
 
ctu_tctu_expr_field (scan_t *scan, where_t where, ctu_t *expr, char *field)
 
ctu_tctu_expr_field_indirect (scan_t *scan, where_t where, ctu_t *expr, char *field)
 
ctu_tctu_expr_unary (scan_t *scan, where_t where, unary_t unary, ctu_t *expr)
 
ctu_tctu_expr_binary (scan_t *scan, where_t where, binary_t binary, ctu_t *lhs, ctu_t *rhs)
 
ctu_tctu_expr_compare (scan_t *scan, where_t where, compare_t compare, ctu_t *lhs, ctu_t *rhs)
 
ctu_tctu_builtin_sizeof (scan_t *scan, where_t where, ctu_t *type)
 
ctu_tctu_builtin_alignof (scan_t *scan, where_t where, ctu_t *type)
 
ctu_tctu_builtin_offsetof (scan_t *scan, where_t where, ctu_t *type, char *field)
 
ctu_tctu_type_name (scan_t *scan, where_t where, vector_t *path)
 
ctu_tctu_type_pointer (scan_t *scan, where_t where, ctu_t *pointer, bool array)
 
ctu_tctu_type_array (scan_t *scan, where_t where, ctu_t *array, ctu_t *length)
 
ctu_tctu_type_function (scan_t *scan, where_t where, const vector_t *params, ctu_t *return_type)
 
ctu_tctu_type_const (scan_t *scan, where_t where, ctu_t *type)
 
ctu_tctu_decl_global (scan_t *scan, where_t where, bool exported, bool mut, char *name, ctu_t *type, ctu_t *value)
 
ctu_tctu_decl_function (scan_t *scan, where_t where, bool exported, char *name, const vector_t *params, char *variadic, ctu_t *return_type, ctu_t *body)
 
ctu_tctu_decl_typealias (scan_t *scan, where_t where, bool exported, char *name, bool newtype, ctu_t *type)
 
ctu_tctu_decl_union (scan_t *scan, where_t where, bool exported, char *name, vector_t *fields)
 
ctu_tctu_decl_struct (scan_t *scan, where_t where, bool exported, char *name, vector_t *fields)
 
ctu_tctu_decl_variant (scan_t *scan, where_t where, bool exported, char *name, ctu_t *underlying, const vector_t *cases)
 
ctu_tctu_field (scan_t *scan, where_t where, char *name, ctu_t *type)
 
ctu_tctu_param (scan_t *scan, where_t where, char *name, ctu_t *type)
 
ctu_tctu_field_init (scan_t *scan, where_t where, char *name, ctu_t *value)
 
ctu_tctu_variant_case (scan_t *scan, where_t where, char *name, bool is_default, ctu_t *expr)
 
ctu_params_t ctu_params_new (const vector_t *params, char *variadic)
 

Function Documentation

◆ ctu_apply()

ctu_t* ctu_apply ( ctu_t decl,
const vector_t attribs 
)

Definition at line 59 of file ast.c.

◆ ctu_attrib()

ctu_t* ctu_attrib ( scan_t scan,
where_t  where,
const vector_t path,
const vector_t args 
)

decorators

Definition at line 51 of file ast.c.

◆ ctu_builtin_alignof()

ctu_t* ctu_builtin_alignof ( scan_t scan,
where_t  where,
ctu_t type 
)

Definition at line 265 of file ast.c.

◆ ctu_builtin_offsetof()

ctu_t* ctu_builtin_offsetof ( scan_t scan,
where_t  where,
ctu_t type,
char *  field 
)

Definition at line 272 of file ast.c.

◆ ctu_builtin_sizeof()

ctu_t* ctu_builtin_sizeof ( scan_t scan,
where_t  where,
ctu_t type 
)

Definition at line 258 of file ast.c.

◆ ctu_decl_function()

ctu_t* ctu_decl_function ( scan_t scan,
where_t  where,
bool  exported,
char *  name,
const vector_t params,
char *  variadic,
ctu_t return_type,
ctu_t body 
)

Definition at line 331 of file ast.c.

◆ ctu_decl_global()

ctu_t* ctu_decl_global ( scan_t scan,
where_t  where,
bool  exported,
bool  mutable,
char *  name,
ctu_t type,
ctu_t value 
)

real declarations

Definition at line 322 of file ast.c.

◆ ctu_decl_struct()

ctu_t* ctu_decl_struct ( scan_t scan,
where_t  where,
bool  exported,
char *  name,
vector_t fields 
)

Definition at line 358 of file ast.c.

◆ ctu_decl_typealias()

ctu_t* ctu_decl_typealias ( scan_t scan,
where_t  where,
bool  exported,
char *  name,
bool  newtype,
ctu_t type 
)

type declarations

Definition at line 343 of file ast.c.

◆ ctu_decl_union()

ctu_t* ctu_decl_union ( scan_t scan,
where_t  where,
bool  exported,
char *  name,
vector_t fields 
)

Definition at line 351 of file ast.c.

◆ ctu_decl_variant()

ctu_t* ctu_decl_variant ( scan_t scan,
where_t  where,
bool  exported,
char *  name,
ctu_t underlying,
const vector_t cases 
)

Definition at line 365 of file ast.c.

◆ ctu_expr_binary()

ctu_t* ctu_expr_binary ( scan_t scan,
where_t  where,
binary_t  binary,
ctu_t lhs,
ctu_t rhs 
)

Definition at line 238 of file ast.c.

◆ ctu_expr_bool()

ctu_t* ctu_expr_bool ( scan_t scan,
where_t  where,
bool  value 
)

Definition at line 139 of file ast.c.

◆ ctu_expr_call()

ctu_t* ctu_expr_call ( scan_t scan,
where_t  where,
ctu_t callee,
const vector_t args 
)

Definition at line 169 of file ast.c.

◆ ctu_expr_cast()

ctu_t* ctu_expr_cast ( scan_t scan,
where_t  where,
ctu_t expr,
ctu_t type 
)

Definition at line 184 of file ast.c.

◆ ctu_expr_char()

ctu_t* ctu_expr_char ( scan_t scan,
where_t  where,
char *  text,
size_t  length 
)

Definition at line 154 of file ast.c.

◆ ctu_expr_compare()

ctu_t* ctu_expr_compare ( scan_t scan,
where_t  where,
compare_t  compare,
ctu_t lhs,
ctu_t rhs 
)

Definition at line 247 of file ast.c.

◆ ctu_expr_deref()

ctu_t* ctu_expr_deref ( scan_t scan,
where_t  where,
ctu_t expr 
)

Definition at line 199 of file ast.c.

◆ ctu_expr_field()

ctu_t* ctu_expr_field ( scan_t scan,
where_t  where,
ctu_t expr,
char *  field 
)

Definition at line 214 of file ast.c.

◆ ctu_expr_field_indirect()

ctu_t* ctu_expr_field_indirect ( scan_t scan,
where_t  where,
ctu_t expr,
char *  field 
)

Definition at line 222 of file ast.c.

◆ ctu_expr_index()

ctu_t* ctu_expr_index ( scan_t scan,
where_t  where,
ctu_t expr,
ctu_t index 
)

Definition at line 206 of file ast.c.

◆ ctu_expr_init()

ctu_t* ctu_expr_init ( scan_t scan,
where_t  where,
const vector_t inits 
)

Definition at line 162 of file ast.c.

◆ ctu_expr_int()

ctu_t* ctu_expr_int ( scan_t scan,
where_t  where,
ctu_integer_t  value 
)

expressions

Definition at line 132 of file ast.c.

◆ ctu_expr_name()

ctu_t* ctu_expr_name ( scan_t scan,
where_t  where,
const vector_t path 
)

Definition at line 177 of file ast.c.

◆ ctu_expr_ref()

ctu_t* ctu_expr_ref ( scan_t scan,
where_t  where,
ctu_t expr 
)

Definition at line 192 of file ast.c.

◆ ctu_expr_string()

ctu_t* ctu_expr_string ( scan_t scan,
where_t  where,
char *  text,
size_t  length 
)

Definition at line 146 of file ast.c.

◆ ctu_expr_unary()

ctu_t* ctu_expr_unary ( scan_t scan,
where_t  where,
unary_t  unary,
ctu_t expr 
)

Definition at line 230 of file ast.c.

◆ ctu_field()

ctu_t* ctu_field ( scan_t scan,
where_t  where,
char *  name,
ctu_t type 
)

internal components

Definition at line 373 of file ast.c.

◆ ctu_field_init()

ctu_t* ctu_field_init ( scan_t scan,
where_t  where,
char *  name,
ctu_t value 
)

Definition at line 389 of file ast.c.

◆ ctu_import()

ctu_t* ctu_import ( scan_t scan,
where_t  where,
vector_t path,
char *  name 
)

Definition at line 42 of file ast.c.

◆ ctu_module()

ctu_t* ctu_module ( scan_t scan,
where_t  where,
const vector_t modspec,
const vector_t imports,
const vector_t decls 
)

modules

Definition at line 33 of file ast.c.

◆ ctu_param()

ctu_t* ctu_param ( scan_t scan,
where_t  where,
char *  name,
ctu_t type 
)

Definition at line 381 of file ast.c.

◆ ctu_params_new()

ctu_params_t ctu_params_new ( const vector_t params,
char *  variadic 
)

extras

Definition at line 410 of file ast.c.

◆ ctu_stmt_assign()

ctu_t* ctu_stmt_assign ( scan_t scan,
where_t  where,
ctu_t dst,
ctu_t src 
)

Definition at line 99 of file ast.c.

◆ ctu_stmt_branch()

ctu_t* ctu_stmt_branch ( scan_t scan,
where_t  where,
ctu_t cond,
ctu_t then,
ctu_t other 
)

Definition at line 121 of file ast.c.

◆ ctu_stmt_break()

ctu_t* ctu_stmt_break ( scan_t scan,
where_t  where,
char *  label 
)

Definition at line 107 of file ast.c.

◆ ctu_stmt_continue()

ctu_t* ctu_stmt_continue ( scan_t scan,
where_t  where,
char *  label 
)

Definition at line 114 of file ast.c.

◆ ctu_stmt_list()

ctu_t* ctu_stmt_list ( scan_t scan,
where_t  where,
vector_t stmts 
)

statements

Definition at line 67 of file ast.c.

◆ ctu_stmt_local()

ctu_t* ctu_stmt_local ( scan_t scan,
where_t  where,
bool  mutable,
char *  name,
ctu_t type,
ctu_t value 
)

Definition at line 74 of file ast.c.

◆ ctu_stmt_return()

ctu_t* ctu_stmt_return ( scan_t scan,
where_t  where,
ctu_t value 
)

Definition at line 83 of file ast.c.

◆ ctu_stmt_while()

ctu_t* ctu_stmt_while ( scan_t scan,
where_t  where,
char *  name,
ctu_t cond,
ctu_t then,
ctu_t other 
)

Definition at line 90 of file ast.c.

◆ ctu_type_array()

ctu_t* ctu_type_array ( scan_t scan,
where_t  where,
ctu_t array,
ctu_t length 
)

Definition at line 297 of file ast.c.

◆ ctu_type_const()

ctu_t* ctu_type_const ( scan_t scan,
where_t  where,
ctu_t type 
)

Definition at line 313 of file ast.c.

◆ ctu_type_function()

ctu_t* ctu_type_function ( scan_t scan,
where_t  where,
const vector_t params,
ctu_t return_type 
)

Definition at line 305 of file ast.c.

◆ ctu_type_name()

ctu_t* ctu_type_name ( scan_t scan,
where_t  where,
vector_t path 
)

types

Definition at line 282 of file ast.c.

◆ ctu_type_pointer()

ctu_t* ctu_type_pointer ( scan_t scan,
where_t  where,
ctu_t pointer,
bool  array 
)

Definition at line 289 of file ast.c.

◆ ctu_variant_case()

ctu_t* ctu_variant_case ( scan_t scan,
where_t  where,
char *  name,
bool  is_default,
ctu_t expr 
)

Definition at line 397 of file ast.c.