Start a Modula-2 experiment

This commit is contained in:
2022-06-05 23:43:45 +02:00
parent 5490f6ce1c
commit f29e68ec93
23 changed files with 994 additions and 1605 deletions

24
boot/Transpiler.mod Normal file
View File

@@ -0,0 +1,24 @@
IMPLEMENTATION MODULE Transpiler;
FROM FIO IMPORT WriteNBytes, StdOut;
FROM SYSTEM IMPORT ADDRESS;
FROM Terminal IMPORT WriteLn;
FROM Lexer IMPORT Lexer, LexerToken, LexerLex, LexerKind;
PROCEDURE Transpile(ALexer: PLexer);
VAR
Token: LexerToken;
WrittenBytes: CARDINAL;
BEGIN
Token := LexerLex(ALexer);
WHILE Token.Kind <> lexerKindEof DO
WrittenBytes := WriteNBytes(StdOut, ADDRESS(ALexer^.Current - ALexer^.Start), ALexer^.Start);
WriteLn();
Token := LexerLex(ALexer)
END
END Transpile;
END Transpiler.