This repository has been archived on 2026-05-11. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
prog-104-p-05-2030/The-Nook-GamesTM/Fundamentals/parsing.h
T
2026-04-20 20:09:16 +02:00

49 lines
804 B
C

#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 */