-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstack.h
More file actions
39 lines (27 loc) · 735 Bytes
/
stack.h
File metadata and controls
39 lines (27 loc) · 735 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* School project to subject IFJ (Formal Languages and Compilers)
* Compiler implementation of imperative language IFJ18
*
* Module for evaluating expressions and conditions
*
* Author: Ján Vavro
* Login: xvavro05
*/
#ifndef IFJ_STACK_H
#define IFJ_STACK_H
#include <stdbool.h>
typedef struct stack_item {
int symbol;
struct stack_item *next;
} t_stack_item;
typedef struct {
t_stack_item *top;
} t_stack;
void stack_init(t_stack *stack);
void push(t_stack *stack, int symbol);
void pop(t_stack *stack);
bool is_terminal(int token);
t_stack_item *top_term(t_stack *stack);
void multi_pop(t_stack *stack, int count);
void insert_after_first_terminal(t_stack *stack, int symbol);
#endif //IFJ_STACK_H