aboutsummaryrefslogtreecommitdiff
path: root/compiler/fuspelc.c
diff options
context:
space:
mode:
authorCamil Staps2016-08-25 20:29:50 +0200
committerCamil Staps2016-08-25 20:29:50 +0200
commit821939c6a6eb5761708146783ebd562422c2a7f7 (patch)
treedd26b29c65431801f4ca45d6952b7806534f9c8c /compiler/fuspelc.c
parentRemove unnecessary includes (diff)
pedantic
Diffstat (limited to 'compiler/fuspelc.c')
-rw-r--r--compiler/fuspelc.c62
1 files changed, 0 insertions, 62 deletions
diff --git a/compiler/fuspelc.c b/compiler/fuspelc.c
deleted file mode 100644
index 48ca8cb..0000000
--- a/compiler/fuspelc.c
+++ /dev/null
@@ -1,62 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-
-#include "eval.h"
-#include "lex.h"
-#include "mem.h"
-#include "parse.h"
-#include "print.h"
-
-int main(void) {
- token_list* tokens = NULL;
-
- while (!feof(stdin)) {
- char program[79];
- if (!fgets(program, 79, stdin)) {
- if (feof(stdin))
- break;
- fprintf(stderr, "Couldn't read input.");
- exit(EXIT_FAILURE);
- }
-
- tokens = lex(tokens, program);
- if (!tokens) {
- fprintf(stderr, "Couldn't lex program.");
- exit(EXIT_FAILURE);
- }
- }
-
- fuspel* pgm = parse(tokens);
- free_token_list(tokens);
- free(tokens);
-
- if (!pgm) {
- fprintf(stderr, "Couldn't parse program.");
- exit(EXIT_FAILURE);
- }
-
- printf("\nParsed program:\n");
- print_fuspel(pgm);
- printf("\n\n\n");
-
- expression to_eval, *evaled;
-
- to_eval.kind = EXPR_NAME;
- to_eval.var1 = my_calloc(1, 5);
- strcpy(to_eval.var1, "main");
-
- evaled = eval(pgm, &to_eval);
- free_expression(&to_eval);
- if (evaled) {
- print_expression(evaled);
- printf("\n");
-
- free_expression(evaled);
- free(evaled);
- }
-
- free_fuspel(pgm);
- free(pgm);
-
- return 0;
-}