/* struct.h */ /* Example: * s-expression: * (+ 1 2 3 (* 3 4)) * equivalent s-expression, expressed as the data structure: * (cons * '+ * (cons * '1 * (cons * '2 * (cons * '3 * (cons * '* * (cons * '3 * '4)))))) * equivalent binary tree: * a * / * b * / \ * + c * / \ * 1 d * / \ * 2 e * / \ * 3 f * / \ * g nil * / \ * * h * / \ * 3 i * / \ * 4 nil * */ struct exp { enum { B_NODE, L_NODE } e; /* If L_NODE, v should be null */ struct exp* car, /* Points to the first element of a list */ * cdr; /* Points to the rest of the list */ char* v; /* If B_NODE, this should point somewhere */ }