librdesc
Loading...
Searching...
No Matches
stack.h
Go to the documentation of this file.
1
15#ifndef RDESC_STACK_H
16#define RDESC_STACK_H
17
18#include "rdesc.h"
19
20#include <stddef.h>
21
22
23struct rdesc_stack;
24
25
27void rdesc_stack_init(struct rdesc_stack **s);
28
30void rdesc_stack_destroy(struct rdesc_stack *s);
31
33void rdesc_stack_push(struct rdesc_stack **s, struct rdesc_token tk);
34
36struct rdesc_token rdesc_stack_pop(struct rdesc_stack **s);
37
40
42size_t rdesc_stack_len(const struct rdesc_stack *s);
43
44
45#endif
The Right-Recursive Descent Parser.
void rdesc_stack_push(struct rdesc_stack **s, struct rdesc_token tk)
Pushes a token onto the stack.
Definition: stack.c:47
void rdesc_stack_init(struct rdesc_stack **s)
Initializes the token stack.
Definition: stack.c:37
size_t rdesc_stack_len(const struct rdesc_stack *s)
Returns the underlying dynamic buffer.
Definition: stack.c:80
struct rdesc_token rdesc_stack_pop(struct rdesc_stack **s)
Removes and returns the top token from the stack.
Definition: stack.c:63
void rdesc_stack_destroy(struct rdesc_stack *s)
Frees memory allocated by the token stack.
Definition: stack.c:58
struct rdesc_token * rdesc_stack_as_ref(struct rdesc_stack *s)
Returns a reference to underlying dynamic buffer.
Definition: stack.c:75
Default implementation of the token backtracking stack.
Definition: stack.c:31
terminal (token) object for context-free grammar
Definition: rdesc.h:43