use of org.whole.examples.lang.imp.visitors.BytecodeGeneratorOperation 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);
}
});
}
Aggregations