diff --git a/schala-lang/language/src/reduced_ast.rs b/schala-lang/language/src/reduced_ast.rs index 695d771..5737587 100644 --- a/schala-lang/language/src/reduced_ast.rs +++ b/schala-lang/language/src/reduced_ast.rs @@ -3,6 +3,7 @@ use std::rc::Rc; use crate::ast::*; use crate::symbol_table::{Symbol, SymbolSpec, SymbolTable}; use crate::builtin::{BinOp, PrefixOp}; +use crate::visitor::{ASTVisitor, Visitable}; #[derive(Debug)] pub struct ReducedAST(pub Vec); @@ -94,6 +95,30 @@ pub enum Func { } } +struct Reducer { + +} + +impl Reducer { + fn new() -> Reducer { + Reducer { } + } + + fn output(&mut self) -> Result { + Err("yolo".to_string()) + } +} + +impl ASTVisitor for Reducer { + +} + +pub fn perform_reduction(mut input: AST, _symbol_table: &SymbolTable) -> Result { + let mut reducer = Reducer::new(); + input.visit(&mut reducer); + reducer.output() +} + impl AST { pub fn reduce(&self, symbol_table: &SymbolTable) -> ReducedAST { let mut output = vec![];