79513348

Date: 2025-03-16 22:57:31
Score: 1
Natty:
Report link

Found the error, was treating all nodes the same even though the struct has an enum.

typedef struct ast {
  node_t type;
  union {
    struct {
      struct ast *node_l;
      struct ast *node_r;
    };
    char *value;
  };
} ast_t;

So,when the eval function reached a leaf node it was trying to access a string rather than a pointer to another node. Fix it by handling the eval function better.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Karidus