codetether-agent 4.7.0-a-002.4

A2A-native AI coding agent for the CodeTether ecosystem
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use anyhow::Result;
use tetherscript::interp::Interpreter;
use tetherscript::lexer::Lexer;
use tetherscript::parser::Parser;

pub fn interpreter(source_name: &str, source: &str) -> Result<Interpreter> {
    let tokens = Lexer::new(source)
        .tokenize()
        .map_err(|e| anyhow::anyhow!("{}:{}: {}", source_name, e.line, e.msg))?;
    let program = Parser::new(tokens)
        .parse_program()
        .map_err(|e| anyhow::anyhow!("{}:{}: {}", source_name, e.line, e.msg))?;
    let mut interp = Interpreter::new();
    interp
        .run_repl(&program)
        .map_err(|e| anyhow::anyhow!("{source_name}: load failed: {e}"))?;
    Ok(interp)
}