Ejemplo n.º 1
0
/* -----------------------------------------------------------------------
 * main function, where all hell breaks loose
 * ----------------------------------------------------------------------- 
 */
int main(int argc, char **argv)
{
  parse_command_line_arguments(argc, argv, &cmdArgs);

  usrdef_init();
  symtab_init();

  /* begin parsing */
  yyparse();

  /* If there were parsing errors, exit. */
  exit_on_errors();

  /* Perform semantic analysis */
  semantic_analysis(program);

  /* If there were errors during semantic analysis, exit. */
  exit_on_errors();

  /* If we should only perform semantic analysis, exit */
  if (cmdArgs.exit_after_sem == 1) {
    exit(0);
  }

  if (cmdArgs.verbose == 1) {
    /* print the user defined data types */
    printf("USER DEFINED DATA TYPES:\n");
    printf("------------------------\n");
    usrdef_print();
    
    /* print the symbol table*/
    printf("\n\n");
    printf("SYMBOL TABLE:\n");
    printf("-------------\n");
    symtab_print(0);
  }

  /* Simple, wasn't it ?!! */

  return 0;
}
Ejemplo n.º 2
0
struct expression_data_t* get_obj_inst_expr_data(struct object_instantiation_t *obj_inst, 
                                                 struct attribute_table_t* attr_hash_table, 
                                                 struct function_declaration_t *statement_func, 
                                                 int line_number)
{
    struct class_table_t *class = NULL;
    struct attribute_table_t *function = NULL;
    HASH_FIND_STR(g_class_table_head, obj_inst->id, class);

    if(class == NULL)
    {
        error_type_not_defined(line_number, obj_inst->id);
        exit_on_errors();
        return NULL;
    }
    else
    {
        /* If there are params (aka its not using default constructor) */
        if(obj_inst->apl != NULL)