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.
83 lines
1.5 KiB
83 lines
1.5 KiB
#ifndef INCLUDE_H
|
|
#define INCLUDE_H
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
|
#include "../hashmap/map.h"
|
|
|
|
/**
|
|
* VariableType is a enum of varible types that will be inside of my language.
|
|
*/
|
|
typedef enum variable_type
|
|
{
|
|
VAR_STRING,
|
|
VAR_INT,
|
|
VAR_CHAR,
|
|
VAR_DOUBLE,
|
|
VAR_VOID
|
|
} variable_type;
|
|
|
|
/**
|
|
* VariableValues is a struct that holds all possible variable values
|
|
*/
|
|
typedef struct variable_values
|
|
{
|
|
variable_type type;
|
|
char _char;
|
|
char *_string;
|
|
int _int;
|
|
double _double;
|
|
void* _void_pointer; //TODO create a concept of "void"
|
|
} variable_values;
|
|
|
|
/**
|
|
* Variables is a struct that has all the information needed for a variables
|
|
*/
|
|
typedef struct variable
|
|
{
|
|
char *name;
|
|
variable_values *value;
|
|
struct variable *next;
|
|
} variable;
|
|
|
|
typedef struct print
|
|
{
|
|
int opperation;
|
|
double value;
|
|
char *string;
|
|
} print;
|
|
|
|
typedef struct logic
|
|
{
|
|
int opperation;
|
|
int expr;
|
|
struct node_info *if_true;
|
|
struct node_info *else_false;
|
|
struct node_info *while_true;
|
|
} logic;
|
|
|
|
|
|
typedef struct node_info
|
|
{
|
|
int opperation;
|
|
enum type{
|
|
|
|
ASSIGNMENT,
|
|
EXPRESSION,
|
|
STATEMENT,
|
|
LOGIC,
|
|
FUNCTION,
|
|
FUNCTION_CALL
|
|
|
|
}type;
|
|
char *name;
|
|
variable *var;
|
|
print printExpression;
|
|
logic logicalExpression;
|
|
struct node_info *next;
|
|
struct node_info *_function_body;
|
|
struct node_info *statement_list;
|
|
struct node_info *local_list;
|
|
struct map_void_t *_var_list;
|
|
} node_info;
|
|
#endif |