You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
122 lines
2.2 KiB
122 lines
2.2 KiB
#ifndef INCLUDE_H
|
|
#define INCLUDE_H
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <stdbool.h>
|
|
#include "hashmap/map.h"
|
|
|
|
#define DEON_DEBUGGING 0
|
|
bool _DEON_DEBUG;
|
|
|
|
typedef enum _variable_type
|
|
{
|
|
VAR_INT,
|
|
VAR_SHORT,
|
|
VAR_BYTE,
|
|
VAR_DOUBLE,
|
|
VAR_STRING,
|
|
VAR_VOID
|
|
} variable_type, *pvariable_type;
|
|
|
|
typedef enum _eval_type
|
|
{
|
|
DECREASE_EQUALS,
|
|
INCREASE_EQUALS
|
|
} eval_type, *peval_type;
|
|
|
|
typedef enum _function_type
|
|
{
|
|
FUNCTION,
|
|
FUNCTION_CALL,
|
|
} function_type, *pfunction_type;
|
|
|
|
typedef enum _print_type
|
|
{
|
|
PRINT_VARIABLE,
|
|
PRINT_CONSTANT
|
|
} print_type, *pprint_type;
|
|
|
|
typedef enum _logic_type
|
|
{
|
|
IF_LOGIC,
|
|
WHILE_LOGIC
|
|
} logic_type, *plogic_type;
|
|
|
|
typedef enum _assignment_type
|
|
{
|
|
ASSIGN_FROM_VAR,
|
|
ASSIGN_FROM_CONST
|
|
} assignment_type, *passignment_type;
|
|
|
|
typedef enum _operation
|
|
{
|
|
ASSIGNMENT_OPERATION,
|
|
LOGIC_OPERATION,
|
|
EXEC_STMT_LIST_OPERATION,
|
|
PRINT_OPERATION,
|
|
FUNCTION_OPERATION,
|
|
} operation, *poperation;
|
|
|
|
typedef struct _variable_values
|
|
{
|
|
variable_type type;
|
|
void* data_ptr;
|
|
} variable_values, *pvariable_values;
|
|
|
|
typedef struct _variable
|
|
{
|
|
char* name;
|
|
variable_values* value;
|
|
struct variable* next;
|
|
} variable, *pvariable;
|
|
|
|
typedef struct _print
|
|
{
|
|
enum _variable_type type;
|
|
void* value;
|
|
} print, *pprint;
|
|
|
|
typedef struct _assignment_operation
|
|
{
|
|
char* from;
|
|
char* to;
|
|
variable* var;
|
|
} assignment_operation, *passignment_operation;
|
|
|
|
typedef struct _logic
|
|
{
|
|
logic_type type;
|
|
char* condition_var;
|
|
struct node_info* stmt_list;
|
|
} logic, *plogic;
|
|
|
|
typedef struct node_info
|
|
{
|
|
enum _operation operation;
|
|
union _operation_type
|
|
{
|
|
logic_type logic;
|
|
function_type func;
|
|
print_type print;
|
|
assignment_type assignment;
|
|
} operation_type;
|
|
|
|
char* name;
|
|
print* print_expr;
|
|
logic* logical_expr;
|
|
assignment_operation* assignment;
|
|
variable* var;
|
|
struct node_info* next;
|
|
struct node_info* function_body;
|
|
struct node_info* statement_list;
|
|
struct node_info* arguments;
|
|
struct map_void_t* scope_map;
|
|
} node_info, *pnode_info;
|
|
|
|
//--- globals used for parsing
|
|
map_void_t* _var_map;
|
|
pnode_info _stmt_head_curser;
|
|
pnode_info _arg_list;
|
|
map_void_t* _function_map;
|
|
#endif
|