/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.domesdaybook.expression.compiler;

import java.util.HashSet;
import java.util.Set;
import net.domesdaybook.expression.parser.AstParser;
import net.domesdaybook.expression.parser.ParseException;
import net.domesdaybook.expression.parser.ParseUtils;
import net.domesdaybook.expression.parser.regularExpressionParser;
import net.domesdaybook.matcher.singlebyte.BitUtilities;
import org.antlr.runtime.tree.CommonTree;
import org.antlr.runtime.tree.Tree;

/**
 *
 * @author matt
 */
public abstract class AstCompiler<T> implements Compiler<T> {

    protected static final String MANY = "*";

    @Override
    public T compile(String expression) throws ParseException {
        AstParser parser = new AstParser();
        Tree tree = parser.parseToAST(expression);
        CommonTree optimisedAST = (CommonTree) parser.optimiseAST(tree);
        return compile(optimisedAST);
    }

    
    public abstract T compile(final CommonTree ast);

}

@@ -3,97 +3,64 @@
 %0A * 
-To change this template, choose Tools %7C Templates%0A * and open the template in the editor.
+Copyright Matt Palmer 2009-2011, All rights reserved.%0A *
 %0A */
@@ -112,56 +112,8 @@
 r;%0A%0A
-import java.util.HashSet;%0Aimport java.util.Set;%0A
 impo
@@ -153,32 +153,32 @@
 rser.AstParser;%0A
+
 import net.domes
@@ -223,186 +223,8 @@
 on;%0A
-import net.domesdaybook.expression.parser.ParseUtils;%0Aimport net.domesdaybook.expression.parser.regularExpressionParser;%0Aimport net.domesdaybook.matcher.singlebyte.BitUtilities;%0A
 impo

Tidy ups