wraith-lang/stack.h

28 lines
511 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;
uint32_t stackCapacity;
uint32_t stackIndex;
} 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 */