summaryrefslogtreecommitdiff
path: root/src/main.c
blob: dc451f9f83d09858626117ad90ff6b10ce15d025 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdlib.h>
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <string.h>

#include "syntax.h"
#include "stages.h"


int main() {
    char* line;
    while (1) {
        line = readline("$ ");
        if (line[0] == '\0') continue;  
        if (strcmp(line, "exit") == 0) exit(0);
        add_history(line);
        Ast ast = lex(line);
        PipelineTree pltree = process_ast(ast);
        execute_pipeline_tree(pltree);
    }
    free(line);
}