#include "usbasic.tab.h"
#include <readline/history.h>
#include <readline/readline.h>
#include <stdio.h>
#include <stdlib.h>
enum NODE_TYPE {
NODE_NUMBERED_LINE,
NODE_PRINT,
NODE_IF,
NODE_ADD,
NODE_SUBTRACT,
NODE_MULTIPLY,
NODE_DIVIDE,
NODE_LT,
NODE_LTE,
NODE_GT,
NODE_GTE,
NODE_EQ,
NODE_NUMBER_INTEGER,
NODE_STRING,
NODE_ID
};
struct node_line_data {
int linum;
struct node_tag *stmt;
};
struct node_string_data {
char *str;
};
struct node_print_data {
struct node_tag *expr;
};
struct node_iff_data {
struct node_tag *pred;
struct node_tag *stmt;
};
struct node_id_data {
char *name;
};
struct node_number_integer_data {
int val;
};
struct node_tag {
enum NODE_TYPE type;
union {
struct node_line_data line;
struct node_string_data string;
struct node_print_data print;
struct node_iff_data iff;
struct node_id_data id;
struct node_number_integer_data number_integer;
} data;
};
struct node_tag *ast_make_string(char *s);
struct node_tag *ast_make_numbered_line(int linum, struct node_tag *stmt);
struct node_tag *ast_make_print(struct node_tag *expr);
struct node_tag *ast_make_if(struct node_tag *pred, struct node_tag *stmt);
struct node_tag *ast_make_id(char *name);
struct node_tag *ast_make_number_integer(int val);
extern int yyparse();
extern void yy_scan_string(char *);
extern void yylex_destroy();
struct node_tag *read_line(char *line);
struct node_tag *read_line_stdin();