|
Zen-C
|


Go to the source code of this file.
Macros | |
| #define | MAX_DEFER 1024 |
| #define | MAX_LOOP_DEPTH 64 |
Functions | |
| void | codegen_node (ParserContext *ctx, ASTNode *node, FILE *out) |
| Generates code for a given AST node. | |
| void | codegen_node_single (ParserContext *ctx, ASTNode *node, FILE *out) |
| Generates code for a single AST node (non-recursive for siblings). | |
| void | codegen_walker (ParserContext *ctx, ASTNode *node, FILE *out) |
| Walker for list of nodes (calls codegen_node recursively). | |
| void | codegen_expression (ParserContext *ctx, ASTNode *node, FILE *out) |
| Generates code for an expression node. | |
| void | codegen_match_internal (ParserContext *ctx, ASTNode *node, FILE *out, int use_result) |
| Internal handler for match statements. | |
| char * | infer_type (ParserContext *ctx, ASTNode *node) |
| ASTNode * | find_struct_def_codegen (ParserContext *ctx, const char *name) |
| char * | get_field_type_str (ParserContext *ctx, const char *struct_name, const char *field_name) |
| char * | extract_call_args (const char *args) |
| void | emit_var_decl_type (ParserContext *ctx, FILE *out, const char *type_str, const char *var_name) |
| char * | replace_string_type (const char *args) |
| const char * | parse_original_method_name (const char *mangled) |
| void | emit_auto_type (ParserContext *ctx, ASTNode *init_expr, Token t, FILE *out) |
| char * | codegen_type_to_string (Type *t) |
| void | emit_func_signature (ParserContext *ctx, FILE *out, ASTNode *func, const char *name_override) |
| char * | strip_template_suffix (const char *name) |
| int | emit_move_invalidation (ParserContext *ctx, ASTNode *node, FILE *out) |
| void | codegen_expression_with_move (ParserContext *ctx, ASTNode *node, FILE *out) |
| void | emit_preamble (ParserContext *ctx, FILE *out) |
| Emits the standard preamble (includes, macros) to the output file. | |
| void | emit_includes_and_aliases (ASTNode *node, FILE *out) |
| void | emit_type_aliases (ASTNode *node, FILE *out) |
| void | emit_global_aliases (ParserContext *ctx, FILE *out) |
| void | emit_struct_defs (ParserContext *ctx, ASTNode *node, FILE *out) |
| void | emit_trait_defs (ASTNode *node, FILE *out) |
| void | emit_enum_protos (ASTNode *node, FILE *out) |
| void | emit_globals (ParserContext *ctx, ASTNode *node, FILE *out) |
| void | emit_lambda_defs (ParserContext *ctx, FILE *out) |
| void | emit_protos (ParserContext *ctx, ASTNode *node, FILE *out) |
| void | emit_impl_vtables (ParserContext *ctx, FILE *out) |
| int | emit_tests_and_runner (ParserContext *ctx, ASTNode *node, FILE *out) |
| Emits test runner and test cases if testing is enabled. | |
| void | print_type_defs (ParserContext *ctx, FILE *out, ASTNode *nodes) |
Variables | |
| ASTNode * | global_user_structs |
| List of user defined structs. | |
| char * | g_current_impl_type |
| Type currently being implemented (in impl block). | |
| int | tmp_counter |
| Counter for temporary variables. | |
| int | defer_count |
| Counter for defer statements in current scope. | |
| ASTNode * | defer_stack [] |
| Stack of deferred nodes. | |
| ASTNode * | g_current_lambda |
| Current lambda being generated. | |
| char * | g_current_func_ret_type |
| Return type of current function. | |
| int | loop_defer_boundary [] |
| Defer stack index at start of each loop. | |
| int | loop_depth |
| Current loop nesting depth. | |
| int | func_defer_boundary |
| Defer stack index at function entry. | |
| #define MAX_DEFER 1024 |
| #define MAX_LOOP_DEPTH 64 |
| void codegen_expression | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |
Generates code for an expression node.


| void codegen_expression_with_move | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |


| void codegen_match_internal | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out, | ||
| int | use_result | ||
| ) |
Internal handler for match statements.


| void codegen_node | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |
Generates code for a given AST node.
| ctx | Parser context. |
| node | The AST node to generate code for. |
| out | Output file stream. |


| void codegen_node_single | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |
Generates code for a single AST node (non-recursive for siblings).


| char * codegen_type_to_string | ( | Type * | t | ) |


| void codegen_walker | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |
Walker for list of nodes (calls codegen_node recursively).


| void emit_auto_type | ( | ParserContext * | ctx, |
| ASTNode * | init_expr, | ||
| Token | t, | ||
| FILE * | out | ||
| ) |


| void emit_enum_protos | ( | ASTNode * | node, |
| FILE * | out | ||
| ) |


| void emit_func_signature | ( | ParserContext * | ctx, |
| FILE * | out, | ||
| ASTNode * | func, | ||
| const char * | name_override | ||
| ) |


| void emit_global_aliases | ( | ParserContext * | ctx, |
| FILE * | out | ||
| ) |

| void emit_globals | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |


| void emit_impl_vtables | ( | ParserContext * | ctx, |
| FILE * | out | ||
| ) |


| void emit_includes_and_aliases | ( | ASTNode * | node, |
| FILE * | out | ||
| ) |

| void emit_lambda_defs | ( | ParserContext * | ctx, |
| FILE * | out | ||
| ) |


| int emit_move_invalidation | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |


| void emit_preamble | ( | ParserContext * | ctx, |
| FILE * | out | ||
| ) |
Emits the standard preamble (includes, macros) to the output file.

| void emit_protos | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |


| void emit_struct_defs | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |


| int emit_tests_and_runner | ( | ParserContext * | ctx, |
| ASTNode * | node, | ||
| FILE * | out | ||
| ) |
Emits test runner and test cases if testing is enabled.


| void emit_trait_defs | ( | ASTNode * | node, |
| FILE * | out | ||
| ) |


| void emit_type_aliases | ( | ASTNode * | node, |
| FILE * | out | ||
| ) |

| void emit_var_decl_type | ( | ParserContext * | ctx, |
| FILE * | out, | ||
| const char * | type_str, | ||
| const char * | var_name | ||
| ) |


| char * extract_call_args | ( | const char * | args | ) |


| ASTNode * find_struct_def_codegen | ( | ParserContext * | ctx, |
| const char * | name | ||
| ) |

| char * get_field_type_str | ( | ParserContext * | ctx, |
| const char * | struct_name, | ||
| const char * | field_name | ||
| ) |


| char * infer_type | ( | ParserContext * | ctx, |
| ASTNode * | node | ||
| ) |


| const char * parse_original_method_name | ( | const char * | mangled | ) |

| void print_type_defs | ( | ParserContext * | ctx, |
| FILE * | out, | ||
| ASTNode * | nodes | ||
| ) |


| char * replace_string_type | ( | const char * | args | ) |


| char * strip_template_suffix | ( | const char * | name | ) |


|
extern |
Counter for defer statements in current scope.
|
extern |
Stack of deferred nodes.
|
extern |
Defer stack index at function entry.
|
extern |
Return type of current function.
|
extern |
Type currently being implemented (in impl block).
|
extern |
Current lambda being generated.
|
extern |
List of user defined structs.
|
extern |
Defer stack index at start of each loop.
|
extern |
Current loop nesting depth.
|
extern |
Counter for temporary variables.