Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
Loading...
Searching...
No Matches
Functions
type.c File Reference

Implementation of type checking and symbol table management functions. More...

#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include "src/ast/ast.h"
#include "type.h"
Include dependency graph for type.c:

Functions

TypeMatchResult types_match (AstNode *type1, AstNode *type2)
 
bool is_numeric_type (AstNode *type)
 
bool is_integer_type (AstNode *type)
 
bool is_pointer_type (AstNode *type)
 
bool is_array_type (AstNode *type)
 
bool is_void_type (AstNode *type)
 
bool is_bool_type (AstNode *type)
 
bool is_struct_type_node (AstNode *type)
 
bool is_function_type (AstNode *type)
 
bool is_cast_valid (AstNode *from_type, AstNode *to_type)
 
bool is_pointer_to_function_type (AstNode *type)
 
const char * type_to_string (AstNode *type, ArenaAllocator *arena)
 
AstNode * get_enclosing_function_return_type (Scope *scope)
 
AstNode * create_struct_type (ArenaAllocator *arena, const char *name, AstNode **member_types, const char **member_names, size_t member_count, size_t line, size_t column)
 
AstNode * get_struct_member_type (AstNode *struct_type, const char *member_name)
 
bool struct_has_member (AstNode *struct_type, const char *member_name)
 
void debug_print_struct_type (AstNode *struct_type, int indent)
 
void debug_print_scope (Scope *scope, int indent_level)
 

Detailed Description

Implementation of type checking and symbol table management functions.

This file contains the implementation of the type checking system declared in type.h. It provides concrete implementations for type comparison, type introspection utilities, and debugging functions for the symbol table and scope management system.

Function Documentation

◆ create_struct_type()

AstNode * create_struct_type ( ArenaAllocator *  arena,
const char *  name,
AstNode **  member_types,
const char **  member_names,
size_t  member_count,
size_t  line,
size_t  column 
)

◆ debug_print_scope()

void debug_print_scope ( Scope *  scope,
int  indent_level 
)

◆ debug_print_struct_type()

void debug_print_struct_type ( AstNode *  struct_type,
int  indent 
)

◆ get_enclosing_function_return_type()

AstNode * get_enclosing_function_return_type ( Scope *  scope)

◆ get_struct_member_type()

AstNode * get_struct_member_type ( AstNode *  struct_type,
const char *  member_name 
)

◆ is_array_type()

bool is_array_type ( AstNode *  type)

◆ is_bool_type()

bool is_bool_type ( AstNode *  type)

◆ is_cast_valid()

bool is_cast_valid ( AstNode *  from_type,
AstNode *  to_type 
)

◆ is_function_type()

bool is_function_type ( AstNode *  type)

◆ is_integer_type()

bool is_integer_type ( AstNode *  type)

◆ is_numeric_type()

bool is_numeric_type ( AstNode *  type)

◆ is_pointer_to_function_type()

bool is_pointer_to_function_type ( AstNode *  type)

◆ is_pointer_type()

bool is_pointer_type ( AstNode *  type)

◆ is_struct_type_node()

bool is_struct_type_node ( AstNode *  type)

◆ is_void_type()

bool is_void_type ( AstNode *  type)

◆ struct_has_member()

bool struct_has_member ( AstNode *  struct_type,
const char *  member_name 
)

◆ type_to_string()

const char * type_to_string ( AstNode *  type,
ArenaAllocator *  arena 
)

◆ types_match()

TypeMatchResult types_match ( AstNode *  type1,
AstNode *  type2 
)