MiniJavaCompiler/src/Main.hs

18 lines
578 B
Haskell
Raw Normal View History

2024-05-01 19:07:04 +00:00
module Main where
2024-05-06 21:15:22 +00:00
import Example
2024-05-07 07:53:16 +00:00
import Typecheck
2024-05-08 13:23:18 +00:00
import Parser.Lexer (alexScanTokens)
import Parser.JavaParser
import ByteCode.ClassFile.Generator
import ByteCode.ClassFile
import Data.ByteString (pack, writeFile)
2024-05-01 19:07:04 +00:00
main = do
2024-05-14 09:12:12 +00:00
let untypedAST = parse $ alexScanTokens "class Testklasse {void something(){return;}}"
2024-05-08 13:23:18 +00:00
let typedAST = head (typeCheckCompilationUnit untypedAST)
let abstractClassFile = classBuilder typedAST emptyClassFile
let assembledClassFile = pack (serialize abstractClassFile)
Data.ByteString.writeFile "Testklasse.class" assembledClassFile