Split the parser from the code generator
This commit is contained in:
@ -7,6 +7,7 @@ from M2RTS import HALT, ExitOnHalt;
|
||||
from Lexer import Lexer, lexer_destroy, lexer_initialize;
|
||||
from Transpiler import transpile;
|
||||
from CommandLineInterface import PCommandLine, parse_command_line;
|
||||
from Parser import PAstModule, parse_module;
|
||||
|
||||
var
|
||||
command_line: PCommandLine;
|
||||
@ -15,6 +16,7 @@ proc compile_from_stream();
|
||||
var
|
||||
lexer: Lexer;
|
||||
source_input: File;
|
||||
ast_module: PAstModule;
|
||||
begin
|
||||
source_input := OpenToRead(command_line^.input);
|
||||
|
||||
@ -29,7 +31,8 @@ begin
|
||||
if IsNoError(source_input) then
|
||||
lexer_initialize(ADR(lexer), source_input);
|
||||
|
||||
transpile(ADR(lexer), StdOut, command_line^.input);
|
||||
ast_module := parse_module(ADR(lexer));
|
||||
transpile(ast_module, StdOut, command_line^.input);
|
||||
|
||||
lexer_destroy(ADR(lexer));
|
||||
|
||||
|
Reference in New Issue
Block a user