start implementing parser

This commit is contained in:
Marvin Schlegel 2024-05-02 22:33:35 +02:00
parent db2b4a142c
commit fe4091da99
3 changed files with 25 additions and 5 deletions

14
Test/TestParser.hs Normal file
View File

@ -0,0 +1,14 @@
module TestParser(tests) where
import Test.HUnit
import Parser.Lexer
import Parser.JavaParser
testIntLiteral = TestCase $ assertEqual "IntLiteral 34" [IntLiteral 34] $ parse (INTLITERAL 34)
testAnd = TestCase $ assertEqual "scan '&&'" [AND] $ alexScanTokens "&&"
tests = TestList [
testIntLiteral
]

View File

@ -1,11 +1,13 @@
module Main where
import Test.HUnit
import Parser.Lexer
import TestLexer
-- import TestParser
otherTest = TestCase $ assertEqual "math" (4+3) 7
tests = TestList [TestLabel "TestLexer" TestLexer.tests, TestLabel "mathTest" otherTest]
tests = TestList [
TestLabel "TestLexer" TestLexer.tests
-- TestLabel "TestParser" TestParser.tests
]
main = do runTestTTAndExit Main.tests

View File

@ -12,7 +12,7 @@ executable compiler
default-language: Haskell2010
hs-source-dirs: src
build-tool-depends: alex:alex, happy:happy
other-modules: Parser.Lexer, Ast
other-modules: Parser.Lexer, Parser.JavaParser, Ast
test-suite tests
type: exitcode-stdio-1.0
@ -22,4 +22,8 @@ test-suite tests
array,
HUnit
build-tool-depends: alex:alex, happy:happy
other-modules: Parser.Lexer, TestLexer
other-modules: Parser.Lexer,
Parser.JavaParser,
Ast,
TestLexer
TestParser