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 @@ PROCEDURE 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