wraith-lang/stack.h

33 lines
740 B
C

#ifndef WRAITH_STACK_H
#define WRAITH_STACK_H
#include "ast.h"
typedef struct StackFrame
{
Node **statements;
uint32_t statementCount;
uint32_t statementCapacity;
Node **declarations;
uint32_t declarationCount;
uint32_t declarationCapacity;
} StackFrame;
typedef struct Stack
{
StackFrame *stackFrames;
uint32_t stackCapacity;
uint32_t stackIndex;
} Stack;
Stack* CreateStack();
void PushStackFrame(Stack *stack);
void PopStackFrame(Stack *stack);
void AddStatement(Stack *stack, Node *statementNode);
Node** GetStatements(Stack *stack, uint32_t *pCount);
void AddDeclaration(Stack *stack, Node *declarationNode);
Node** GetDeclarations(Stack *stack, uint32_t *pCount);
#endif /* WRAITH_STACK_H */