#ifndef PARSING_H
#define PARSING_H

#include <stddef.h>

enum node_type {
    EMPTY,
    PLUS,
    MINUS,
    PRINT
};

enum child {
    LEFT,
    RIGHT
};

enum condition_type {
    INT,
    CHILD
};

union condition {
    int n;
    enum child child;
};

struct node {
    enum node_type node_type;
    union condition condition;
    enum condition_type condition_type;
    struct node *left;
    struct node *right;
};

struct queue {
    struct node *node;
    struct queue *next;
};

struct queue *enqueue(struct queue *queue, struct node *node);
struct node *dequeue(struct queue **queue);
void queue_destroy(struct queue *queue);

struct node *create_node(const char *line);
struct node *parse_file(const char *filename);
void execute_tree(struct node *node, int value);

#endif /* ! PARSING_H */