-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40d20f5
commit 57fb88f
Showing
1 changed file
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import argparse | ||
from lexer import Lexer | ||
from parser import Parser | ||
from execution_engine import ExecutionEngine | ||
from error_corrector import ErrorCorrector | ||
from jit_compiler import JITCompiler | ||
from logger import Logger | ||
from plugin_manager import plugin_manager | ||
|
||
def process_mdri(file_path): | ||
with open(file_path, 'r') as file: | ||
content = file.read() | ||
|
||
# Error correction | ||
error_corrector = ErrorCorrector() | ||
corrected_content = error_corrector.correct_errors(content) | ||
Logger.info("Error correction complete") | ||
|
||
# Tokenization | ||
lexer = Lexer(corrected_content) | ||
tokens = lexer.tokens | ||
Logger.debug(f"Tokens: {tokens}") | ||
|
||
# Parsing | ||
parser = Parser(tokens) | ||
ast = parser.ast | ||
Logger.debug(f"AST: {ast}") | ||
|
||
# JIT Compilation | ||
jit_compiler = JITCompiler() | ||
compiled_code = jit_compiler.compile(corrected_content) | ||
Logger.info("JIT compilation complete") | ||
|
||
# Execution | ||
execution_engine = ExecutionEngine(ast) | ||
execution_engine.execute() | ||
Logger.info("Execution complete") | ||
|
||
# Plugin execution | ||
plugin_manager.execute_plugins(corrected_content.splitlines()) | ||
Logger.info("Plugin execution complete") | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='MDRI Processing Engine') | ||
parser.add_argument('file', help='Path to the MDRI file') | ||
args = parser.parse_args() | ||
|
||
process_mdri(args.file) | ||
|
||
if __name__ == "__main__": | ||
main() |