ast_node.h 603 B

123456789101112131415161718192021222324252627282930
  1. #ifndef _PGMPREFIX_AST_NODE_H_
  2. #define _PGMPREFIX_AST_NODE_H_
  3. #include "dd_dynamic_array.h"
  4. // Struct for a single node
  5. struct ast_node {
  6. int token;
  7. struct dd_dynamic_array children;
  8. int value;
  9. };
  10. // Actions
  11. struct ast_node *ast_create(int token, int value);
  12. void ast_child_add(struct ast_node *parent, struct ast_node *child);
  13. void ast_delete(struct ast_node *node);
  14. // Debug - Print node tree
  15. void ast_print(struct ast_node *node);
  16. // AST table
  17. struct ast_node* ast_table[100];
  18. int ast_table_lastentry;
  19. // structs table
  20. struct ast_node* struct_table[100];
  21. int struct_table_lastentry;
  22. #endif