wraith-lang/src/stack.h

28 lines
509 B
C
Raw Normal View History

2021-04-18 20:14:50 +00:00
#ifndef WRAITH_STACK_H
#define WRAITH_STACK_H
#include "ast.h"
typedef struct StackFrame
{
2021-04-20 17:47:40 +00:00
Node **nodes;
uint32_t nodeCount;
uint32_t nodeCapacity;
2021-04-18 20:14:50 +00:00
} StackFrame;
typedef struct Stack
{
StackFrame *stackFrames;
2021-04-21 06:51:26 +00:00
int32_t stackCapacity;
int32_t stackIndex;
2021-04-18 20:14:50 +00:00
} Stack;
2021-04-18 22:29:54 +00:00
Stack* CreateStack();
void PushStackFrame(Stack *stack);
void PopStackFrame(Stack *stack);
2021-04-18 20:14:50 +00:00
2021-04-20 17:47:40 +00:00
void AddNode(Stack *stack, Node *statementNode);
Node** GetNodes(Stack *stack, uint32_t *pCount);
2021-04-18 20:14:50 +00:00
2021-04-20 17:47:40 +00:00
#endif /* WRAITH_STACK_H */