#include <gc.h>
#include <gmp.h>
-# include "keywords.h"
+#include "keywords.h"
const char *BLANKS = " \t";
joyList
};
+typedef struct list_node* JoyList;
-struct JoyType {
+typedef struct {
enum JoyTypeType kind;
union {
int boolean;
mpz_t i;
- struct list_node* el;
+ JoyList el;
char *symbol;
} value;
-} name ;
+} JoyType;
struct list_node {
- struct JoyType head; /* Should this be a pointer? */
- struct list_node* tail;
-} JoyList;
+ JoyType head; /* Should this be a pointer? */
+ JoyList tail;
+};
+
+#define EMPTY_LIST (JoyList)NULL
+
+
-#define EMPTY_LIST (struct list_node*)NULL
void*
}
-struct list_node*
-push_integer_from_str(char *str, struct list_node* tail)
+JoyList
+push_integer_from_str(char *str, JoyList tail)
{
- struct list_node* el;
+ JoyList el;
el = GC_malloc(sizeof(struct list_node));
el->head.kind = joyInt;
mpz_init_set_str(el->head.value.i, str, 10);
}
-
/* Pre-declare so we can use it in print_node(). */
void
-print_list(struct list_node* el);
+print_list(JoyList el);
void
-print_node(struct JoyType j)
+print_node(JoyType j)
{
switch (j.kind) {
case joyInt:
void
-print_list(struct list_node* el)
+print_list(JoyList el)
{
while (NULL != el) {
print_node(el->head);
}
-struct list_node*
+JoyList
make_non_list_node(char *text, size_t size)
{
struct list_node *node;
/* Create a new list_node with a joyList head. */
-struct list_node*
+JoyList
make_list_node(struct list_node *el)
{
struct list_node *node;
*/
-struct list_node*
+JoyList
parse_list(char **text)
{
/*
Get the next node from the text, updating text
to point to the rest of the, uh, text.
*/
-struct list_node*
+JoyList
parse_node(char **text)
{
char *rest;
}
-struct list_node*
+JoyList
text_to_expression(char *text)
{
struct list_node *result, *head, *tail;