From 2c928ad69b7ba9adeaa0a48b102525855d2f0987 Mon Sep 17 00:00:00 2001 From: Matthias Raba Date: Fri, 14 Jun 2024 08:52:06 +0200 Subject: [PATCH] renamed Generator -> Builder --- project.cabal | 4 ++-- src/ByteCode/{Generator.hs => Builder.hs} | 2 +- src/Main.hs | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) rename src/ByteCode/{Generator.hs => Builder.hs} (98%) diff --git a/project.cabal b/project.cabal index eccbaa4..60ff6fb 100644 --- a/project.cabal +++ b/project.cabal @@ -24,7 +24,7 @@ executable compiler ByteCode.ByteUtil, ByteCode.ClassFile, ByteCode.Assembler, - ByteCode.Generator, + ByteCode.Builder, ByteCode.Constants test-suite tests @@ -47,5 +47,5 @@ test-suite tests ByteCode.ByteUtil, ByteCode.ClassFile, ByteCode.Assembler, - ByteCode.Generator, + ByteCode.Builder, ByteCode.Constants diff --git a/src/ByteCode/Generator.hs b/src/ByteCode/Builder.hs similarity index 98% rename from src/ByteCode/Generator.hs rename to src/ByteCode/Builder.hs index d6a8980..dfebf89 100644 --- a/src/ByteCode/Generator.hs +++ b/src/ByteCode/Builder.hs @@ -1,4 +1,4 @@ -module ByteCode.Generator where +module ByteCode.Builder where import ByteCode.Constants import ByteCode.ClassFile (ClassFile (..), ConstantInfo (..), MemberInfo(..), Operation(..), Attribute(..), opcodeEncodingLength) diff --git a/src/Main.hs b/src/Main.hs index 27bf217..3f4c329 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -4,7 +4,7 @@ import Example import Typecheck import Parser.Lexer (alexScanTokens) import Parser.JavaParser -import ByteCode.Generator +import ByteCode.Builder import ByteCode.ClassFile import Data.ByteString (pack, writeFile) import System.Environment @@ -12,9 +12,9 @@ import System.FilePath.Posix (takeDirectory) main = do args <- getArgs - let filename = if (length args) > 0 - then args!!0 - else error "Missing filename, I need to know what to compile" + let filename = if null args + then error "Missing filename, I need to know what to compile" + else args!!0 let outputDirectory = takeDirectory filename print ("Compiling " ++ filename) file <- readFile filename