#include "stack.h" #include struct stack *stack_push(struct stack *s, int e) { struct stack *new = malloc(sizeof(struct stack)); new->data = e; new->next = NULL; new->next = s; return new; } struct stack *stack_pop(struct stack *s) { if (s == NULL) { return NULL; } struct stack *res = s->next; free(s); return res; } int stack_peek(struct stack *s) { return s->data; } struct tstack *tstack_push(struct tstack *s, struct token *e) { struct tstack *new = malloc(sizeof(struct tstack)); new->token = e; new->next = NULL; new->next = s; return new; } struct tstack *tstack_pop(struct tstack *s) { if (s == NULL) { return NULL; } struct tstack *res = s->next; free(s); return res; } struct token *tstack_peek(struct tstack *s) { return s->token; }