18 lines
608 B
Python
18 lines
608 B
Python
from plugins import AbstractCommand
|
|
from typing import List
|
|
from plugin_repository import PluginRepository
|
|
import logging
|
|
|
|
|
|
def compile_program(plugin_repository: PluginRepository, program_source: List[dict]) -> List[AbstractCommand]:
|
|
logger = logging.getLogger('compiler')
|
|
|
|
compiled_program = []
|
|
for command_source in program_source:
|
|
logger.debug(f"Compiling: [{command_source['name']}],{command_source['args']}")
|
|
compiled_program.append(
|
|
plugin_repository.get_compiler(command_source['name']).compile(**command_source['args'])
|
|
)
|
|
|
|
return compiled_program
|