#include #include #include "lex.h" #include "parser.h" #include "ps_graph.h" int main(int argc, char *argv[]) { struct lexer *lex; struct expr_node *node; if (argc < 2) { printf("Usage: %s \n", argv[0]); return 1; } lex = lex_create(argv[1]); node = parse_expression(lex); lex_free(lex); if (node) { FILE *file; struct graph_range graph; graph.xmin = -20.0; graph.xmax = 20.0; graph.ymin = -20.0; graph.ymax = 20.0; graph.step = 0.01; file = fopen("out.ps", "w"); ps_export_graph(file, node, &graph); fclose(file); file = fopen("graph.dot", "w"); node_debug_print_gv(node, file); fclose(file); node_free(node); } return 0; }