2024-02-25 18:49:26 +00:00
|
|
|
pub mod abstract_tree;
|
|
|
|
pub mod context;
|
|
|
|
pub mod error;
|
|
|
|
pub mod lexer;
|
|
|
|
pub mod parser;
|
2024-02-23 12:40:01 +00:00
|
|
|
|
2024-02-25 18:49:26 +00:00
|
|
|
use abstract_tree::{Statement, Value};
|
2024-02-25 05:38:41 +00:00
|
|
|
use chumsky::{prelude::*, Parser};
|
2024-02-25 18:49:26 +00:00
|
|
|
use context::Context;
|
|
|
|
use error::Error;
|
2024-02-25 08:12:09 +00:00
|
|
|
|
|
|
|
pub struct Interpreter<P> {
|
2024-02-25 18:49:26 +00:00
|
|
|
_parser: P,
|
|
|
|
_context: Context,
|
2024-02-25 08:12:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl<'src, P> Interpreter<P>
|
|
|
|
where
|
|
|
|
P: Parser<'src, &'src str, Statement, extra::Err<Rich<'src, char>>>,
|
|
|
|
{
|
2024-02-25 18:49:26 +00:00
|
|
|
pub fn run(&self, _source: &'src str) -> Result<Value, Error<'src>> {
|
|
|
|
todo!();
|
2024-02-23 17:14:15 +00:00
|
|
|
|
2024-02-25 18:49:26 +00:00
|
|
|
// let final_value = self
|
|
|
|
// .parser
|
|
|
|
// .parse(source)
|
|
|
|
// .into_result()?
|
|
|
|
// .run(&self.context)?;
|
2024-02-23 12:40:01 +00:00
|
|
|
|
2024-02-25 18:49:26 +00:00
|
|
|
// Ok(final_value)
|
2023-09-28 19:58:01 +00:00
|
|
|
}
|
|
|
|
}
|