From a7e84eea087a35721a971e827149f0ca5fba4676 Mon Sep 17 00:00:00 2001 From: bjculkin Date: Tue, 21 Mar 2017 14:08:50 -0400 Subject: Remove version 1 files Remove the old, not used version 1 files from the repository. Check the history if you care about them. --- .../src/bjc/dicelang/v1/ast/DiceASTOptimizer.java | 55 ---------------------- 1 file changed, 55 deletions(-) delete mode 100644 dice-lang/src/bjc/dicelang/v1/ast/DiceASTOptimizer.java (limited to 'dice-lang/src/bjc/dicelang/v1/ast/DiceASTOptimizer.java') diff --git a/dice-lang/src/bjc/dicelang/v1/ast/DiceASTOptimizer.java b/dice-lang/src/bjc/dicelang/v1/ast/DiceASTOptimizer.java deleted file mode 100644 index fa4f0ca..0000000 --- a/dice-lang/src/bjc/dicelang/v1/ast/DiceASTOptimizer.java +++ /dev/null @@ -1,55 +0,0 @@ -package bjc.dicelang.v1.ast; - -import bjc.dicelang.v1.ast.nodes.IDiceASTNode; -import bjc.dicelang.v1.ast.optimization.IOptimizationPass; -import bjc.utils.data.ITree; -import bjc.utils.funcdata.FunctionalList; -import bjc.utils.funcdata.IList; -import bjc.utils.funcdata.IMap; - -/** - * Contains optimizations appliable to a dice AST - * - * @author ben - * - */ -public class DiceASTOptimizer { - private IList passes; - - /** - * Create a new optimizer - */ - public DiceASTOptimizer() { - passes = new FunctionalList<>(); - } - - /** - * Add a pass to the list of optimization passes - * - * @param pass - * The pass to add - */ - public void addPass(IOptimizationPass pass) { - passes.add(pass); - } - - /** - * Optimize the passed in tree - * - * @param ast - * The tree to optimize - * @param enviroment - * The enviroment for variable references - * @return The optimized tree - */ - public ITree optimizeTree(ITree ast, IMap> enviroment) { - ITree optimizedTree = passes.reduceAux(ast, (currentPass, currentTree) -> { - return currentTree.collapse(currentPass::optimizeLeaf, (operator) -> { - return (nodes) -> { - return currentPass.optimizeOperator(operator, nodes); - }; - }, (tree) -> tree); - }, (tree) -> tree); - return optimizedTree; - } -} -- cgit v1.2.3