Start a Modula-2 experiment

This commit is contained in:
2022-06-11 22:52:13 +02:00
parent f5c4a27a6d
commit 910261b408
28 changed files with 844 additions and 2574 deletions

26
boot/Transpiler.mod Normal file
View File

@@ -0,0 +1,26 @@
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);
IF ALexer^.Current^ <> '.' THEN
WriteLn()
END;
Token := LexerLex(ALexer)
END
END Transpile;
END Transpiler.