Search in sources :

Example 1 with ImpSpecificBuilderAdapter

use of org.whole.examples.lang.imp.builders.ImpSpecificBuilderAdapter in project whole by wholeplatform.

the class ImpLanguageDeployer method deploy.

public void deploy(ReflectionFactory platform) {
    platform.addLanguageKit(new ImpLanguageKit());
    platform.addOperationFactory(ImpLanguageKit.URI, GenericBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ImpGenericBuilderAdapter((IImpBuilder) strategy, entityContext);
        }
    });
    platform.addOperationFactory(ImpLanguageKit.URI, SpecificBuilderAdapterOperation.ID, new IBuilderFactory() {

        public IBuilder create(IBuilder strategy, IEntityContext entityContext) {
            return new ImpSpecificBuilderAdapter(strategy, entityContext);
        }
    });
    platform.addOperationFactory(ImpLanguageKit.URI, PrettyPrinterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new ImpPrettyPrinterVisitor((PrettyPrinterOperation) operation);
        }
    });
    platform.addOperationFactory(ImpLanguageKit.URI, InterpreterOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            if (stage == 0)
                return new ImpInterpreterVisitor((InterpreterOperation) operation);
            else
                return null;
        }
    });
    platform.addOperationFactory(ImpLanguageKit.URI, ValidatorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return ImpTraversalFactory.instance.topDown(ImpTraversalFactory.instance.sequence(new ImpResolverValidatorVisitor((ValidatorOperation) operation), new ImpDefUseValidatorVisitor((ValidatorOperation) operation)), false);
        }
    });
    platform.addOperationFactory(ImpLanguageKit.URI, BytecodeGeneratorOperation.ID, new IVisitorFactory() {

        public IVisitor create(IOperation operation, int stage) {
            return new ImpBytecodeGeneratorVisitor((BytecodeGeneratorOperation) operation);
        }
    });
}
Also used : IBuilder(org.whole.lang.builders.IBuilder) IOperation(org.whole.lang.operations.IOperation) PrettyPrinterOperation(org.whole.lang.operations.PrettyPrinterOperation) IVisitor(org.whole.lang.visitors.IVisitor) IEntityContext(org.whole.lang.contexts.IEntityContext) IBuilderFactory(org.whole.lang.builders.IBuilderFactory) ValidatorOperation(org.whole.lang.operations.ValidatorOperation) IVisitorFactory(org.whole.lang.visitors.IVisitorFactory) ImpResolverValidatorVisitor(org.whole.examples.lang.imp.visitors.ImpResolverValidatorVisitor) ImpGenericBuilderAdapter(org.whole.examples.lang.imp.builders.ImpGenericBuilderAdapter) ImpSpecificBuilderAdapter(org.whole.examples.lang.imp.builders.ImpSpecificBuilderAdapter) BytecodeGeneratorOperation(org.whole.examples.lang.imp.visitors.BytecodeGeneratorOperation) ImpBytecodeGeneratorVisitor(org.whole.examples.lang.imp.visitors.ImpBytecodeGeneratorVisitor) IImpBuilder(org.whole.examples.lang.imp.builders.IImpBuilder) ImpDefUseValidatorVisitor(org.whole.examples.lang.imp.visitors.ImpDefUseValidatorVisitor) ImpInterpreterVisitor(org.whole.examples.lang.imp.visitors.ImpInterpreterVisitor) ImpPrettyPrinterVisitor(org.whole.examples.lang.imp.visitors.ImpPrettyPrinterVisitor)

Aggregations

IImpBuilder (org.whole.examples.lang.imp.builders.IImpBuilder)1 ImpGenericBuilderAdapter (org.whole.examples.lang.imp.builders.ImpGenericBuilderAdapter)1 ImpSpecificBuilderAdapter (org.whole.examples.lang.imp.builders.ImpSpecificBuilderAdapter)1 BytecodeGeneratorOperation (org.whole.examples.lang.imp.visitors.BytecodeGeneratorOperation)1 ImpBytecodeGeneratorVisitor (org.whole.examples.lang.imp.visitors.ImpBytecodeGeneratorVisitor)1 ImpDefUseValidatorVisitor (org.whole.examples.lang.imp.visitors.ImpDefUseValidatorVisitor)1 ImpInterpreterVisitor (org.whole.examples.lang.imp.visitors.ImpInterpreterVisitor)1 ImpPrettyPrinterVisitor (org.whole.examples.lang.imp.visitors.ImpPrettyPrinterVisitor)1 ImpResolverValidatorVisitor (org.whole.examples.lang.imp.visitors.ImpResolverValidatorVisitor)1 IBuilder (org.whole.lang.builders.IBuilder)1 IBuilderFactory (org.whole.lang.builders.IBuilderFactory)1 IEntityContext (org.whole.lang.contexts.IEntityContext)1 IOperation (org.whole.lang.operations.IOperation)1 PrettyPrinterOperation (org.whole.lang.operations.PrettyPrinterOperation)1 ValidatorOperation (org.whole.lang.operations.ValidatorOperation)1 IVisitor (org.whole.lang.visitors.IVisitor)1 IVisitorFactory (org.whole.lang.visitors.IVisitorFactory)1