summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 8264f976e6172db2df85f87efadcb1c7e2c00a3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
pub mod ast;
pub mod semantic;
pub mod taiga;

use std::io::{self, BufRead, Write};

fn main() {
    let stdin = io::stdin();
    let mut handle = stdin.lock();
    loop {
        let mut input = String::new();
        print!("taiga> ");
        io::stdout().flush().unwrap();
        if let Ok(n) = handle.read_line(&mut input) {
            if n == 0 { break; }
            let program = taiga::parse_Program(&input);
            println!("{:?}", program);
            if let Ok(program) = program {
                println!("{:?}", semantic::translate::translate(&program));
            }
        }
        else {
            break;
        }
    }
}