20 lines
612 B
Python
20 lines
612 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:
|
|
cmd = command_source['command']
|
|
args = command_source['args']
|
|
logger.debug(f"Compiling: [{cmd}:{args}]")
|
|
compiled_program.append(
|
|
plugin_repository.get_compiler(cmd).compile(**args)
|
|
)
|
|
|
|
return compiled_program
|