/*
 * Some plans for a simple implementation of Scheme.
 */

#include <stdio.h>

/*
 * Types of Scheme values
 */
typedef enum { PAIR, INT, REAL, CHAR, STRING, SYMBOL } schemetype;

/**
 * Scheme pairs.
 */
typedef struct pair {
  struct sval *car;
  struct sval *cdr;
} pair;

/*
 * Scheme values.
 */
typedef struct sval {
  schemetype type;
  union {
    pair p;
    int i;
    double d;
    char c;
    char *s;
  } contents;
} sval;
 
/*
 * Print a Scheme value to the given file.
 */
int printSVal(FILE *outport, sval *val);

/*
 * Read the next Scheme value from the given file.
 */
sval *readSVal(FILE *inport);

/**
 * Free the memory associated with a Scheme value (and any
 * Scheme values it references, in the case of pairs).
 */
void freeSVal(sval *val);
