/**************************************************************************************
 * Chaga compiler                                                                     *
 * Copyright (C) 2026 Robert James Bruce                                              *
 *                                                                                    *
 * This file is part of the Chaga compiler.                                           *
 *                                                                                    *
 * The Chaga compiler is free software: you can redistribute it and/or modify it      *
 * under the terms of the GNU General Public License as published by the              *
 * Free Software Foundation, either version 3 of the License, or (at your option) any *
 * later version.                                                                     *
 *                                                                                    *
 * The Chaga compiler is distributed in the hope that it will be useful, but WITHOUT  *
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or              *
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License               *
 * for more details.                                                                  *
 *                                                                                    *
 * You should have received a copy of the GNU General Public License                  *
 * along with the Chaga compiler. If not, see <https://www.gnu.org/licenses/>.        *
 **************************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <sys/stat.h>

#ifndef CHAGA_DATA_STRUCTURES
#include "chaga_compiler-data_structures.h"
#endif

#ifndef CHAGA_COMPILER_CONSTANTS
#include "chaga_compiler-constants.h"
#endif

#include "chaga_compiler-diagnostic_tools.h"





size_t string_length (string_node *);
expression_stack_node * push_expression_stack (expression_stack_node *, char *, int, char *, stackframe_node *);
expression_stack_node * pop_expression_stack (expression_stack_node *);
statement_stack_node * push_statement_stack (statement_stack_node *, chaga_statement_type, unsigned long long int);
statement_stack_node * pop_statement_stack (statement_stack_node *);
string_node * append_to_string (string_node *, char);
string_node * delete_string (string_node *);
symtab_node * delete_symbol_table (symtab_node *);
token_node * add_token_element (string_node *, int, unsigned long long int);
cst_node * add_element_to_concrete_syntax_tree (token_node *, char *, int);
ast_node * add_element_to_abstract_syntax_tree (char *, int, chaga_statement_type, token_node *, symtab_node *);
param_node * add_element_to_parameter_list (param_node *, chaga_attribute_datatype, char *);
symtab_node * add_symbol_table_element (symtab_node *, char *, chaga_attribute_type, chaga_attribute_datatype, char, unsigned long long int, unsigned long long int, unsigned long long int, unsigned long long int, int, int);
symtab_node * add_temporary_variables_to_symbol_table_to_evaluate_numerical_expressions (symtab_node *, ast_node *);
stackframe_node * add_stackframe_element (stackframe_node *, symtab_node *, size_t);
token_node * delete_token_list (token_node *);
char * read_input_file (char *, size_t *);
symtab_node * retrieve_unused_temporary_variable_for_numerical_expression_processing (symtab_node *, chaga_attribute_type, chaga_attribute_datatype, unsigned long long int);
symtab_node * retrieve_symbol_table_element (symtab_node *, char *, chaga_attribute_type, unsigned long long int );
symtab_node * retrieve_symbol_table_element_for_function_or_procedure_name (symtab_node *, char *, chaga_attribute_type);
unsigned long long int retrieve_highest_scope_level (symtab_node *);
int identifier_already_exists_in_symbol_table (symtab_node *, char *, unsigned long long int);
void symbol_table_set_status_to_available_unused_temporary_variables_for_numerical_expression_processing (symtab_node *, unsigned long long int);
stackframe_node * retrieve_stackframe_offset (stackframe_node *, symtab_node *);
stackframe_node * retrieve_stackframe_offset_for_input_datatype_identifier_name_and_scope (stackframe_node *, char *, unsigned long long int);






