1
0
Fork 0

Add initial interpreter functionality (missing vars and funcs)

This commit is contained in:
Vili Sinervä 2025-02-03 16:35:06 +02:00
parent 8d856d0651
commit 520357d930
No known key found for this signature in database
GPG key ID: DF8FEAF54EFAC996
4 changed files with 254 additions and 1 deletions

View file

@ -1,9 +1,27 @@
use std::io;
use interpreter::interpret;
use parser::parse;
use tokenizer::tokenize;
mod ast;
mod interpreter;
mod parser;
mod token;
mod tokenizer;
mod value;
pub fn compile(code: &str) {
let tokens = tokenizer::tokenize(code);
parser::parse(&tokens);
}
pub fn start_interpreter() {
let lines = io::stdin().lines();
for line in lines {
if let Ok(code) = line {
println!("{}", interpret(&parse(&tokenize(&code))));
}
}
}