324 Commits

Author SHA1 Message Date
Lucas
30bd5a0b5c Oder Documentation and Delete unnecessary
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-07-08 13:20:41 +02:00
Maximilian Stahl
9760e39a29 Test updated
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-07-05 13:57:07 +02:00
Maximilian Stahl
93e17e5415 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-05 13:51:29 +02:00
Maximilian Stahl
b151edc2fd Updated README.md 2024-07-05 13:51:14 +02:00
Lucas
c0d8ab8399 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-05 13:50:11 +02:00
Lucas
f50bb7efd7 refactoring 2024-07-05 13:49:43 +02:00
Maximilian Stahl
51a390752b Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-05 13:46:31 +02:00
Maximilian Stahl
3114064038 Fixed Generation 2024-07-05 13:46:18 +02:00
Lucas
745db43b34 make and input
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-05 13:44:11 +02:00
Lucas
e0286e0840 Merge branch 'Endabgabe' of https://gitea.hb.dhbw-stuttgart.de/i22005/JavaCompiler into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-05 13:25:01 +02:00
Lucas
ebef717141 refactoring 2024-07-05 13:24:48 +02:00
Maximilian Stahl
3de54afa93 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
# Conflicts:
#	src/main/java/bytecode/MethodCodeGen.java
2024-07-05 13:23:57 +02:00
Maximilian Stahl
30d3cfa44a Fix and Final Test File 2024-07-05 13:23:09 +02:00
efa1a21655 Fix for MethodCallNode
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-05 06:30:55 -04:00
3fb11e5d7e Fixed methotcall with params
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-05 06:20:49 -04:00
Bruder John
c6e61defce Revert "Some small changes for SemanticAnalyzer"
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This reverts commit dbde4e8047.
2024-07-05 09:34:06 +02:00
Bruder John
dbde4e8047 Some small changes for SemanticAnalyzer
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-05 09:13:27 +02:00
5a12d61623 Changed testfiles
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 21:59:37 -04:00
f5bccab651 Small change
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 21:40:21 -04:00
0de5c3e993 Fixed MethodCall
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 21:03:52 -04:00
3628a0a4d8 Merge branch 'Endabgabe' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 20:04:23 -04:00
36f0683240 Fixed crement assign 2024-07-04 20:04:10 -04:00
Purplumbi504
97aadb9ba8 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 23:41:17 +02:00
Purplumbi504
e5dcbb8f99 Fixing AstBuilder For
pp script
2024-07-04 23:41:04 +02:00
e96f30fe19 Updated Loop Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 23:39:54 +02:00
64b15af6ef Null Test Deleted
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 23:15:22 +02:00
4ff6854094 NonCalculation Type added
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 23:14:00 +02:00
0a9cc7655a Changed For Structure
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 23:07:54 +02:00
7e66b5b8e3 Fixed Target = null
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 22:53:33 +02:00
d835a98e6f Some fixes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 16:41:44 -04:00
240913d422 Fixed MemberAccess Type
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 22:38:39 +02:00
4bee432294 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 22:24:59 +02:00
0cf4715782 Fixes of Constructor 2024-07-04 22:24:50 +02:00
Purplumbi504
3c0f7e857a Adding comments to ASTBuilder und ANTL Grammar
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 21:57:53 +02:00
Purplumbi504
2b7e0d0d42 Changing location of Makefile
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 21:13:38 +02:00
Purplumbi504
bd61a0e595 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 21:11:35 +02:00
Purplumbi504
24407a5c1c Revert test case directory: singleFeatureTests 2024-07-04 21:11:21 +02:00
195440e9d9 Added SemanticAnalyzer ElseIfStatement
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 20:49:54 +02:00
6fa57cf319 Type Error Change
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 20:36:36 +02:00
1de6add080 Fixe Type Error
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 20:23:43 +02:00
c315966219 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 19:45:09 +02:00
c2c4974c76 More Abgabe Tests working 2024-07-04 19:44:59 +02:00
Purplumbi504
85e0cf3807 Revert test case directory: singleFeatureTests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 19:10:21 +02:00
Purplumbi504
6f3fb02666 Fixing test case directory: singleFeatureTests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 19:03:44 +02:00
Purplumbi504
435697053a Fixing ReflectionTests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 18:57:36 +02:00
8eba420d48 Some changes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 12:29:23 -04:00
fbff03c3d7 Add typenode again
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 11:31:21 -04:00
721e1caa79 Merge remote-tracking branch 'origin/Endabgabe' into code-generator 2024-07-04 11:30:54 -04:00
6d3e1f859e Increment/Decrement assign
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 11:20:10 -04:00
f6b34bf70b readme.md gelöscht
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 15:16:39 +00:00
430d551f7d README.md aktualisiert
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 15:08:02 +00:00
8e0d627505 Readme fixed
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 17:06:49 +02:00
6b6051cad8 Readme fixed
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 17:04:48 +02:00
1f8e045b1e Readme 2024-07-04 17:03:49 +02:00
ceb1231632 Fixed Renaming Errors
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 17:02:02 +02:00
Maximilian Stahl
31929878b0 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
# Conflicts:
#	src/main/java/semantic/SemanticAnalyzer.java
#	src/test/java/semantic/SemanticTest.java
2024-07-04 16:55:15 +02:00
Lucas
ea97f34398 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 16:49:27 +02:00
Lucas
2f7b310254 refactoring, readme 2024-07-04 16:49:14 +02:00
Bruder John
9b8155ebab added class identifier to member acces node
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 16:31:45 +02:00
entep01
4775c3f47e Fixes and changed For Builder 2024-07-04 16:30:19 +02:00
Bruder John
2e3a7850a4 Fix Double Name 2024-07-04 16:29:42 +02:00
Bruder John
d925a3258c Add Class name to Memberaccesnode and identifier to assignable
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 15:58:46 +02:00
Lucas
fb5372bc8f make clean
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 15:22:37 +02:00
Lucas
f29be4fd8c E2E tests done
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 15:22:05 +02:00
Bruder John
34bb86c7f4 fixed if Check
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-07-04 10:40:13 +02:00
Bruder John
c0e197e2d0 added type to expression
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 09:09:55 +02:00
Bruder John
ae872ed906 removed Begin to Tast test
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-04 08:29:50 +02:00
91552ad147 Endabgabe Test Klassen
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-07-03 23:04:07 +02:00
084808c3ab Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 21:24:29 +02:00
d19748766f Fixed If Else Statements und If Else Tests 2024-07-03 21:24:19 +02:00
Bruder John
4bdb65a6ce fixed MemberAccess in MethodCalls
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 20:47:44 +02:00
Bruder John
97e0c228d6 Merge branch 'Endabgabe' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 20:37:35 +02:00
Bruder John
d4be77ceb2 Changed Some Tests 2024-07-03 20:36:57 +02:00
ca539add98 More Semantic Test
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 20:36:49 +02:00
1bcf396f95 Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 20:28:16 +02:00
8ba58d492b Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
# Conflicts:
#	src/test/java/semantic/EndToTypedAstTest.java
#	src/test/resources/input/typedAstFeatureTests/CorrectTest.java
2024-07-03 20:27:41 +02:00
Bruder John
ed25868ff7 fix tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 20:27:29 +02:00
879fa08cdc SemanticAnalyzer Fail Tests 2024-07-03 20:26:39 +02:00
Bruder John
0e512161a0 Added Class name to Member accesnode
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 20:22:09 +02:00
Bruder John
ba08c6f6b0 Merge branch 'Endabgabe' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 19:25:59 +02:00
c5aea85965 New Generated
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 18:49:15 +02:00
2a1d0a0b8a Merge remote-tracking branch 'origin/Endabgabe' into Endabgabe
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 18:47:59 +02:00
f1abe5d5a8 Fixed ASTBuilder Tests 2024-07-03 18:47:46 +02:00
Bruder John
a9d7e841f5 changed correct Semantic check 2024-07-03 18:42:14 +02:00
Bruder John
b7863d0684 fixed thistar
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 18:33:30 +02:00
Bruder John
7ccff3208c added Semanticcheck to main
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 18:24:02 +02:00
Bruder John
3e0e6f8327 Commpiling Compiler in Intelij
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 18:22:04 +02:00
Bruder John
ab5a51d3b1 Merge remote-tracking branch 'origin/ParserAlterStand' into johns-branch
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-07-03 18:16:53 +02:00
Bruder John
a4c1c502ab Revert "Merge branch 'NewParser' into johns-branch"
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This reverts commit 84ecf316cd, reversing
changes made to 7ddea8f18d.
2024-07-03 18:15:57 +02:00
Bruder John
7d441116bd Merge branch 'code-generator' into chainedMethodsSemanticCheck
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-07-03 17:45:42 +02:00
Bruder John
8afa3b8461 Added Own Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 17:41:17 +02:00
Bruder John
84ecf316cd Merge branch 'NewParser' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 17:22:30 +02:00
Bruder John
7ddea8f18d removed Correct test
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 17:06:44 +02:00
46154fbb01 Merged Code, Semantic and Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 17:03:12 +02:00
9aac795c07 Merge branch 'Tests' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into NewParser 2024-07-03 17:01:50 +02:00
e59f4e7190 Merge branch 'johns-branch' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into NewParser 2024-07-03 17:01:33 +02:00
Lucas
e6a2b0fe9d Semantic Tests work
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 15:58:02 +02:00
Bruder John
44c2f551de Merge branch 'Tests' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 15:50:46 +02:00
Bruder John
bad034acfd Merge branch 'chainedMethodsSemanticCheck' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 15:38:25 +02:00
Bruder John
ba73e1bd45 Revert "added chainedmethods"
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This reverts commit b7affd75ae.
2024-07-03 15:35:39 +02:00
Bruder John
b7affd75ae added chainedmethods
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 15:35:09 +02:00
Lucas
2ef50f93a9 added system properties
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 15:21:58 +02:00
Lucas
1cf1aaf837 Doku, AllFeaturesClassExample not running!!!
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 14:08:27 +02:00
Lucas
2bf73385af small changes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 13:06:06 +02:00
Lucas
b072af346b Huge Changes in TestFiles, ReflectionsTest, much more
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 13:04:33 +02:00
Lucas
27baa429b4 small changes in main for bytecode
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 09:35:50 +02:00
bd76135895 Some changes
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-07-02 21:43:03 -04:00
Lucas
6cec17eb45 Merge remote-tracking branch 'origin/code-generator' into Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-03 00:47:49 +02:00
87be850a0e Revert "Merge branch 'main' into code-generator"
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This reverts commit 8956362033, reversing
changes made to b58fa00c9a.
2024-07-02 18:07:48 -04:00
72f82ff863 Revert "Merge branch 'NewParser' into code-generator"
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This reverts commit f0dd6d5eb6, reversing
changes made to 8956362033.
2024-07-02 18:07:42 -04:00
7419953510 Revert "Merge branch 'johns-branch' into code-generator"
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This reverts commit 449b895d20, reversing
changes made to f0dd6d5eb6.
2024-07-02 18:07:26 -04:00
449b895d20 Merge branch 'johns-branch' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 17:52:23 -04:00
f0dd6d5eb6 Merge branch 'NewParser' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 17:52:04 -04:00
8956362033 Merge branch 'main' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 17:51:24 -04:00
Lucas
ed4aa2d59b small changes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 23:51:06 +02:00
Lucas
6760a17f00 Revert "Merged Code Gen!!!"
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This reverts commit 671317f28b.
2024-07-02 23:49:44 +02:00
Lucas
671317f28b Merged Code Gen!!!
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 23:45:54 +02:00
Lucas
e862a7427b Merge remote-tracking branch 'origin/code-generator' into Tests 2024-07-02 23:45:33 +02:00
233725778f Merge branch 'johns-branch' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into NewParser 2024-07-02 20:37:42 +02:00
3227d69fc1 Merged Main and Code-Generator
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-07-02 20:25:15 +02:00
4ca6972ccd Merge branch 'code-generator' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into NewParser 2024-07-02 20:10:54 +02:00
0047f6c08e Merge remote-tracking branch 'origin/NewParser' into NewParser
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 20:08:23 +02:00
88ce9e52f0 More Tests for ASTBuilder
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 20:08:08 +02:00
Purplumbi504
437de74cc6 New Grammer
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 19:13:59 +02:00
Purplumbi504
ca77307f0c Merge remote-tracking branch 'origin/NewParser' into NewParser
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 19:12:29 +02:00
Purplumbi504
5f46130439 Adding Switch Case AST 2024-07-02 19:12:19 +02:00
3e1456351c Merge remote-tracking branch 'origin/NewParser' into NewParser
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
# Conflicts:
#	src/test/java/parser/AstBuilderTest.java
2024-07-02 18:00:29 +02:00
d26cd0c13a For Test 2024-07-02 17:57:48 +02:00
Purplumbi504
cfde5219a4 Merge remote-tracking branch 'origin/NewParser' into NewParser
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 17:51:11 +02:00
Purplumbi504
f414e278bb Adding Test Cases 2024-07-02 17:50:58 +02:00
Maximilian Stahl
741a56cb99 Merge remote-tracking branch 'origin/NewParser' into NewParser
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
# Conflicts:
#	src/main/java/parser/astBuilder/ASTBuilder.java
2024-07-02 17:39:05 +02:00
Maximilian Stahl
02e5f3a729 Fixes and changed For Builder 2024-07-02 17:36:48 +02:00
Bruder John
f7338a06b3 added MemberAccess to Assignable
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 15:47:33 +02:00
Bruder John
3996082fa7 Merge branch 'main' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 14:52:13 +02:00
903e87901e Merge pull request 'Constructor Fix' (#18) from NewParser into main
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Reviewed-on: #18
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-07-02 12:51:46 +00:00
775beb60fe Merge pull request 'Gemeinsame Changes von Discord' (#19) from Tests into main
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Reviewed-on: #19
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-07-02 12:50:57 +00:00
Bruder John
2537051668 fix if field and parameter have same identifier
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 14:31:44 +02:00
Bruder John
82356ec189 set types of expressions
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 10:36:22 +02:00
Bruder John
561eafbf4c fixed constructor node parameter decleration
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-02 08:48:37 +02:00
b58fa00c9a Fixed some problems
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 21:49:25 -04:00
Lucas
92990e4042 gemeinsame dc changes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 23:53:42 +02:00
Lucas
3500ffd377 small changes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 23:31:22 +02:00
Lucas
771b92bfd7 Merge branch 'main' into Tests 2024-07-01 23:31:00 +02:00
c94c7a6477 Constructor Fix
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 23:20:15 +02:00
c7ad574474 Merge pull request 'code-generator' (#13) from code-generator into main
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Reviewed-on: #13
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-07-01 21:14:36 +00:00
22c3850062 Merge branch 'main' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 17:14:10 -04:00
Lucas
21da31dee3 Merge branch 'main' into Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 23:10:16 +02:00
Lucas
294df16e89 small changes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 23:09:53 +02:00
3112660880 Merge pull request 'johns-branch' (#17) from johns-branch into main
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Reviewed-on: #17
Reviewed-by: i22035 <i22035@hb.dhbw-stuttgart.de>
2024-07-01 21:08:23 +00:00
c135819ba0 Merge branch 'main' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 17:07:52 -04:00
e94cd9cc2a Merge pull request 'NewParser' (#16) from NewParser into main
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Reviewed-on: #16
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-07-01 21:07:27 +00:00
Maximilian Stahl
dcd20a2394 AST Builder Tests and Fixes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 16:40:02 +02:00
Bruder John
71ffb8bb83 added for loops to the test
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 16:04:27 +02:00
Bruder John
2d455ba197 added som more checks
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 15:45:57 +02:00
Bruder John
77fecfa476 added Type to Assignable
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 13:25:27 +02:00
Bruder John
36e56fa66e added some tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 12:58:24 +02:00
Bruder John
f3e3158460 added private fields
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 12:58:11 +02:00
Bruder John
7b1e6fced4 Merge branch 'NewParser' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 09:35:01 +02:00
Bruder John
4d5c0017b4 Merge branch 'main' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-07-01 08:32:44 +02:00
093beb9ef1 Merge branch 'NewParser' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-30 19:28:01 -04:00
2ae0988986 Changed For Loop Structure
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-30 22:17:52 +02:00
Lucas
18fc17b707 Merge branch 'main' into Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-30 18:34:02 +02:00
Lucas
bea71838ac Reflections: not running
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-30 18:33:01 +02:00
dfded3e592 Added ASTBuilder Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-30 13:20:58 +02:00
0298e2cb76 Merge branch 'NewParser' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-29 20:24:54 -04:00
Purplumbi504
dccd34db73 Adding Test Cases
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-29 16:05:11 +02:00
90f91d58d1 OutputDirectory
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-27 19:56:54 -04:00
612c967023 Bytecode for if/elseif/else
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 19:56:31 -04:00
f12e553ffc Merge branch 'main' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 17:34:30 -04:00
f24e279596 Merge branch 'NewParser' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 17:33:50 -04:00
c5fc378eed Bytecode for loops
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 17:32:50 -04:00
Purplumbi504
27f50b9c66 Adding EmptyClass Test AST
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-27 21:14:02 +02:00
3e901ea254 Merge pull request 'NewParser' (#15) from NewParser into main
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Reviewed-on: #15
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-06-27 16:56:32 +00:00
85ae06048c Add Return if Returntype is Void
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 18:55:28 +02:00
cd845cd91c Fixed Merge Conflicts
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 18:45:14 +02:00
Bruder John
4d21d8e94e fix method overlaoding semantic check
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-27 15:17:05 +02:00
Bruder John
a34c7ded50 added Some Semantic Checks
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 15:04:01 +02:00
78d5528733 Merge pull request 'More Tests, Structure, etc. Huge Changes' (#14) from Tests into main
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Reviewed-on: #14
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-06-27 10:49:35 +00:00
Bruder John
10eb17497e added some Semantic Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 10:45:38 +02:00
Bruder John
576146c4fc Merge branch 'Tests' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 08:35:07 +02:00
Bruder John
bf365194be Merge branch 'NewParser' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 08:31:56 +02:00
Bruder John
35b3e9ee46 Added Some Semantice Checks
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-27 08:11:17 +02:00
Maximilian Stahl
88a25207e9 Added Interface and fixed bugs
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-26 17:34:40 +02:00
Lucas
4e56760dd6 Old spelling mistake in semantic fixed
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-26 16:28:53 +02:00
Lucas
347bdcbd94 Update .gitignore
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-26 16:22:38 +02:00
Lucas
d594bacb7d Semantic Tests refactored
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-26 16:21:04 +02:00
Lucas
eb313464f0 Tests (structure) refactored
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-26 11:25:24 +02:00
Bruder John
8163d0b61e removing Semantic Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-26 09:55:12 +02:00
Bruder John
92e1daab5b Merge branch 'NewParser' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-26 09:51:33 +02:00
70a3788030 Merge branch 'NewParser' into code-generator
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-25 17:48:47 -04:00
b562a789a0 Fixed Merge Conflicts and Bugs
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-25 22:35:28 +02:00
c05ad761d7 Merge branch 'main' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into NewParser 2024-06-25 21:53:14 +02:00
Lucas
34d17660ef Tests refactored
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-25 18:05:58 +02:00
Lucas
cc6d26e17d Tests refactored
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-25 18:05:26 +02:00
Lucas
f9743efddc Merge branch 'main' into Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-25 16:43:42 +02:00
Lucas
b37e065857 Small changes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-25 16:41:04 +02:00
4c5473827e Small change
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-24 18:52:55 -04:00
d631b01c82 ConstructorNode and NotNode
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-23 16:06:07 -04:00
Bruder John
8cd22c6e4c Removed some Exercices from Tests because parser is not ready for
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-23 20:57:53 +02:00
ef0bc99bbf Bytecode for dotSubstractionNode
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-23 14:54:53 -04:00
99948fef07 Bytecode for ValueNode
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-23 14:35:57 -04:00
66c9481b3e Add all accept methods
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-23 13:43:42 -04:00
fd8d451ba7 Renaming again
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-23 11:33:33 -04:00
f27a7471bc Merge branch 'NewParser' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-23 11:19:09 -04:00
a15f684c04 Add visitors and code for binary expressions
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-23 11:10:06 -04:00
4a78ab62a1 Fixed some Merge Conflicts
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-23 14:18:42 +02:00
Purplumbi504
8d3602eda3 Renaiming packages
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-23 13:59:06 +02:00
Purplumbi504
fcaeb850ba Merge remote-tracking branch 'origin/NewParser' into NewParser
# Conflicts:
#	src/main/java/ast/ClassNode.java
#	src/main/java/ast/expressions/AssignableExpressionNode.java
#	src/main/java/ast/expressions/ExpressionNode.java
#	src/main/java/ast/expressions/IExpressionNode.java
#	src/main/java/ast/expressions/binaryexpression/BinaryExpressionNode.java
#	src/main/java/ast/expressions/binaryexpression/CalculationExpressionNode.java
#	src/main/java/ast/expressions/binaryexpression/DotExpressionNode.java
#	src/main/java/ast/expressions/binaryexpression/DotSubstractionExpressionNode.java
#	src/main/java/ast/expressions/binaryexpression/EnumDotOperator.java
#	src/main/java/ast/expressions/binaryexpression/EnumLineOperator.java
#	src/main/java/ast/expressions/binaryexpression/EnumNonCalculationOperator.java
#	src/main/java/ast/expressions/binaryexpression/NonCalculationExpressionNode.java
#	src/main/java/ast/expressions/unaryexpression/MemberAccessNode.java
#	src/main/java/ast/expressions/unaryexpression/NotExpressionNode.java
#	src/main/java/ast/expressions/unaryexpression/UnaryExpressionNode.java
#	src/main/java/ast/members/ConstructorNode.java
#	src/main/java/ast/members/MainMethodNode.java
#	src/main/java/ast/statement/ForStatementNode.java
#	src/main/java/ast/statement/WhileStatementNode.java
#	src/main/java/ast/statement/ifstatement/ElseStatementNode.java
#	src/main/java/ast/statement/ifstatement/IfElseStatementNode.java
#	src/main/java/ast/statement/ifstatement/IfStatementNode.java
#	src/main/java/ast/statement/statementexpression/methodcallstatementnexpression/TargetNode.java
#	src/main/java/ast/statementexpressions/AssignStatementExpressionNode.java
#	src/main/java/ast/statementexpressions/AssignableExpressionNode.java
#	src/main/java/ast/statementexpressions/CrementExpressionStatementExpressionNode.java
#	src/main/java/ast/statementexpressions/IStatementExpressionNode.java
#	src/main/java/ast/statementexpressions/NewDeclarationStatementExpressionNode.java
#	src/main/java/ast/statementexpressions/crementExpression/CrementType.java
#	src/main/java/ast/statementexpressions/crementExpression/DecrementExpressionNode.java
#	src/main/java/ast/statementexpressions/crementExpression/IncrementExpressionNode.java
#	src/main/java/ast/statementexpressions/methodcallstatementnexpression/ChainedMethodNode.java
#	src/main/java/ast/statementexpressions/methodcallstatementnexpression/MethodCallStatementExpressionNode.java
#	src/main/java/ast/statements/BlockStatementNode.java
#	src/main/java/ast/statements/IStatementNode.java
#	src/main/java/ast/statements/LocalVariableDeclarationNode.java
#	src/main/java/ast/statements/ReturnStatementNode.java
#	src/main/java/bytecode/ClassCodeGen.java
#	src/main/java/bytecode/Mapper.java
#	src/main/java/bytecode/MethodCodeGen.java
#	src/main/java/parser/astBuilder/ASTBuilder.java
#	src/main/java/parser/generated/SimpleJava.interp
#	src/main/java/parser/generated/SimpleJava.tokens
#	src/main/java/parser/generated/SimpleJavaBaseListener.java
#	src/main/java/parser/generated/SimpleJavaBaseVisitor.java
#	src/main/java/parser/generated/SimpleJavaLexer.interp
#	src/main/java/parser/generated/SimpleJavaLexer.java
#	src/main/java/parser/generated/SimpleJavaLexer.tokens
#	src/main/java/parser/generated/SimpleJavaListener.java
#	src/main/java/parser/generated/SimpleJavaParser.java
#	src/main/java/parser/generated/SimpleJavaVisitor.java
#	src/main/java/semantic/SemanticVisitor.java
2024-06-23 10:58:46 +02:00
Purplumbi504
864ddbaeee Fix errors in if Statments.
For and Do While loop as While loop.
2024-06-23 10:57:25 +02:00
fb3f822160 Merge branch 'main' into code-generator
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-21 19:25:35 -04:00
fd6da5cad2 Merge pull request 'johns-branch' (#12) from johns-branch into main
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Reviewed-on: #12
Reviewed-by: i22035 <i22035@hb.dhbw-stuttgart.de>
2024-06-21 16:30:55 +00:00
Bruder John
c44118c872 Fixed all
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-21 18:28:08 +02:00
Bruder John
0020f582a1 Merge branch 'main' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-21 18:26:07 +02:00
8b5a0d528e Merge pull request 'Tests, Structure, More' (#10) from Tests into main
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
Reviewed-on: #10
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-06-21 16:16:53 +00:00
Bruder John
1b91e25d17 fixed tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-21 18:09:32 +02:00
Bruder John
9edee73705 Merge branch 'NewParser' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-21 18:07:18 +02:00
Bruder John
5bf9a4fc73 added wrong type in if clause
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-21 18:06:49 +02:00
6d36eb109c Added Enums for Operators and MainMethodNode
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-21 18:02:29 +02:00
Bruder John
7b41c45cd5 Fixed all Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-21 17:03:49 +02:00
Bruder John
cf41babcb7 Added BaseType And refferenz Type
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-21 16:42:27 +02:00
Bruder John
b9ada16dd1 Fixed SemanticCheck for new AST and added Some Test
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-21 15:23:48 +02:00
Bruder John
b5738034b0 Merge branch 'NewParser' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-21 10:47:54 +02:00
b9f6014f59 Assignments
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-20 18:12:04 -04:00
50a52a1e87 Added Interface
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-20 18:44:42 +02:00
d3e9fa9b43 Added Public to Attributes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-20 17:52:54 +02:00
Bruder John
0ec65af9f9 Added Method Check
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-20 16:53:31 +02:00
Bruder John
fd8c3b066a Trying to change to new AST
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-20 11:43:58 +02:00
af64f88198 Merge branch 'NewParser' into code-generator
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-19 15:22:00 -04:00
978b5a2b4a Fixed MethodNode and Visitor
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-19 21:19:09 +02:00
837e751094 Generate jar with first class as main
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-19 12:53:14 -04:00
Lucas
8cc67080ec Small changes
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-19 17:09:38 +02:00
Lucas
cfcb61d49e Running now possible with make or java.exe -jar in console
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-19 16:32:46 +02:00
Lucas
8f742191bb Small changes
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-19 14:19:47 +02:00
Lucas
102961bccc Added logging
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-19 12:49:46 +02:00
Lucas
f59d7e9918 First Tests for Parser, pls check
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-17 17:42:50 +02:00
Lucas
0732712e61 Make, Main: Raupenpiler startup
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-17 13:42:56 +02:00
57c2023215 Merge remote-tracking branch 'origin/NewParser' into code-generator
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-16 16:52:24 -04:00
Purplumbi504
12ab402746 Fix errors in if Statments.
For and Do While loop as While loop.
2024-06-16 13:15:39 +02:00
bf7a642233 Added Expression Visitors
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-16 13:01:26 +02:00
3639b2a4f8 Added new Parser Visitors
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-15 16:59:35 +02:00
330b92a79f Deleted old grammar
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-15 14:05:03 +02:00
8094a93582 Added new Grammar
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-15 13:15:55 +02:00
0271313a05 Merge branch 'johns-branch' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into parser 2024-06-15 12:49:47 +02:00
Lucas
b6cc925e02 Fixed Makefile
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-12 18:01:21 +02:00
Bruder John
e552bd5ada Added Basic RefTypes to InstVar and SematicCheck
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-12 17:33:59 +02:00
Lucas
6a971345d4 Structure and more
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-06-12 11:17:16 +02:00
Bruder John
56d316a6d0 Changed to InstVar
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-06-01 18:37:13 +02:00
Lucas
8d6190b130 Structure, Makefile, Docs, TestCompilerOutput, more; TODO: fix marked Problems in Makefile; fix Compiler (look at TestCompilerOutput docs)
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-05-31 17:09:04 +02:00
09e36a84dc Merge remote-tracking branch 'origin/parser2.0' into code-generator
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-05-31 11:32:53 +02:00
Maximilian Stahl
e395c4d96b Fixed Boolean and Char Literal
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 11:32:11 +02:00
Bruder John
8a5f307947 Fix Type
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 11:27:02 +02:00
514f7d724a Merge remote-tracking branch 'origin/parser2.0' into code-generator
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 11:20:38 +02:00
Lucas
9f40949f5a Structure
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 11:20:31 +02:00
Maximilian Stahl
de5c2a5002 Added Parser Visitors
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 11:16:25 +02:00
Bruder John
22a30d5956 Added typecheck for Assignment
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-05-31 11:08:41 +02:00
Lucas
1132ff015c Changes in tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 11:05:45 +02:00
Lucas
2a20a91d35 Refactor structure and more
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 10:55:41 +02:00
407b03620e Code for assignment
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 10:46:23 +02:00
Lucas
b2e1745d51 Merge branch 'main' into Tests
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-31 10:04:40 +02:00
Lucas
a0e55d7b27 first testrun of the day 2024-05-31 10:00:46 +02:00
Lucas
5a28d88f6a comments 2024-05-31 09:58:07 +02:00
1c77a99f54 Merge pull request 'johns-branch' (#9) from johns-branch into main
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
Reviewed-on: #9
Reviewed-by: i22007 <i22007@hb.dhbw-stuttgart.de>
2024-05-30 17:11:50 +00:00
Bruder John
c483babaf5 Merge branch 'main' into johns-branch
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-30 19:10:42 +02:00
Bruder John
403ab70655 Adapted Binary Expression
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2024-05-30 19:07:29 +02:00
Bruder John
d91e3ad819 added maven test
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Has been cancelled
2024-05-14 17:59:53 +02:00
Bruder John
8b9b70b9ee Added Test for Semantic Analyzier 2024-05-14 17:47:26 +02:00
Bruder John
7906a38cdd Merge remote-tracking branch 'origin/Tests' into johns-branch 2024-05-14 16:47:33 +02:00
Lucas
dd424cda99 Tests and Main 2024-05-14 15:47:49 +02:00
1d5bfdd88f Merge pull request 'johns-branch' (#7) from johns-branch into main
Reviewed-on: #7
Reviewed-by: i22007 <i22007@hb.dhbw-stuttgart.de>
2024-05-14 13:35:21 +00:00
Bruder John
149caf5202 Merge branch 'main' into johns-branch 2024-05-14 15:35:03 +02:00
b03ea72eca Merge pull request 'code-generator' (#8) from code-generator into main
Reviewed-on: #8
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-05-14 13:34:51 +00:00
d2f8ea1e78 Merge remote-tracking branch 'origin/johns-branch' into code-generator 2024-05-14 15:33:56 +02:00
Bruder John
c5bb038fc3 added same Method Declaration 2024-05-14 15:31:02 +02:00
b7d5a5c625 Fixed empty class code gen 2024-05-14 15:26:05 +02:00
Lucas
f781d8eeb6 Merge remote-tracking branch 'origin/johns-branch' into Tests 2024-05-14 13:49:10 +02:00
Bruder John
b64e2efc82 Changed To TypeNode 2024-05-14 13:46:14 +02:00
Lucas
8b6189ea33 Tests and Main 2024-05-14 13:16:28 +02:00
91f7db24f6 Merge remote-tracking branch 'origin/johns-branch' into code-generator 2024-05-14 13:00:54 +02:00
Bruder John
33df2c1c0a Fixed errors 2024-05-14 12:53:40 +02:00
6250ee781c Merge remote-tracking branch 'origin/johns-branch' into code-generator 2024-05-14 12:52:07 +02:00
Bruder John
6318085c00 added TypeCheckResult 2024-05-14 12:51:49 +02:00
f5da71478f Merge remote-tracking branch 'origin/johns-branch' into code-generator 2024-05-14 11:44:44 +02:00
Bruder John
a8638fe70c fixed error 2024-05-14 11:40:43 +02:00
edb7aafd77 Merge branch 'main' into code-generator 2024-05-14 11:39:41 +02:00
c4061125c4 Add method parameters to bytecode 2024-05-14 11:39:14 +02:00
Lucas
1d9d7e1f00 Testsuite, MainTest, Main 2024-05-14 11:22:33 +02:00
f77143599b Merge pull request 'changed to interfaces' (#6) from johns-branch into main
Reviewed-on: #6
Reviewed-by: i22007 <i22007@hb.dhbw-stuttgart.de>
2024-05-14 09:21:26 +00:00
Bruder John
1441e34078 Merge branch 'main' into johns-branch 2024-05-14 11:20:44 +02:00
Bruder John
dfe96d9a87 changed to interfaces 2024-05-14 11:19:31 +02:00
8e7b64c38d Merge pull request 'code-generator' (#5) from code-generator into main
Reviewed-on: #5
Reviewed-by: Johannes Ehlert <i22005@hb.dhbw-stuttgart.de>
2024-05-14 09:04:37 +00:00
d27ec0643a Add visitor for class code generation 2024-05-14 10:58:04 +02:00
79a140b683 Merge branch 'main' of https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0 into code-generator 2024-05-14 10:01:20 +02:00
Lucas
e4d0b93880 Merge remote-tracking branch 'origin/main' 2024-05-14 10:00:38 +02:00
b6bbf7e1d5 Merge pull request 'johns-branch' (#4) from johns-branch into main
Reviewed-on: #4
Reviewed-by: i22035 <i22035@hb.dhbw-stuttgart.de>
2024-05-14 08:00:06 +00:00
Lucas
584dcc6beb Merge remote-tracking branch 'origin/main' 2024-05-14 09:56:15 +02:00
i22007
1fbec0d754 First try with visitors 2024-05-13 20:15:17 +02:00
Bruder John
e987faae64 Added Basic Typecheck for integers 2024-05-10 10:43:09 +02:00
Bruder John
2bae802cb2 changed to visitor pattern 2024-05-09 22:39:26 +02:00
Bruder John
0052b5b547 Added Int Literal 2024-05-09 19:13:18 +02:00
Bruder John
b773793937 Merge branch 'main' into johns-branch 2024-05-09 14:23:07 +02:00
Bruder John
43cafcd01f added Expression analysis 2024-05-09 14:21:07 +02:00
651a8b6ebf Merge pull request 'parser' (#3) from parser into main
Reviewed-on: #3
Reviewed-by: i22007 <i22007@hb.dhbw-stuttgart.de>
2024-05-09 12:06:31 +00:00
6b7fc09f8f Changed AST Tree 2024-05-09 13:55:45 +02:00
4acf4dfe24 Added Statements and Expressions for parser 2024-05-09 13:47:38 +02:00
IchHab4Euro
0bce8639f5 Updated Contructor Parsing 2024-05-09 12:56:37 +02:00
Bruder John
a86bede5a7 Added down to Expression 2024-05-09 00:13:23 +02:00
Bruder John
03645f7a84 fixed bugs after update branch 2024-05-08 23:47:37 +02:00
Bruder John
73b9eeddb0 Merge branch 'main' into johns-branch 2024-05-08 23:46:28 +02:00
Bruder John
159413dd7d fixed bugs 2024-05-08 23:44:17 +02:00
Lucas
275eceb80a Merge branch 'main' of https://gitea.hb.dhbw-stuttgart.de/i22005/JavaCompiler 2024-05-08 16:12:54 +02:00
i22007
458983fc68 Change on filepath 2024-05-08 16:12:04 +02:00
Lucas
9d6717a9ce nix 2024-05-08 16:11:28 +02:00
Lucas
4699e655fe Merge remote-tracking branch 'origin/main'
# Conflicts:
#	src/main/java/CompilerInput.txt
#	src/main/java/Main.java
2024-05-08 15:55:43 +02:00
Lucas
b7cb34c6ec Structure and Fixes 2024-05-08 15:54:23 +02:00
Bruder John
c4a35decba Merge branch 'main' into johns-branch 2024-05-08 15:22:05 +02:00
Bruder John
b2e86ca631 moved Eample to resources 2024-05-08 15:04:57 +02:00
Bruder John
c0b30f9620 Added Identifier 2024-05-08 14:40:34 +02:00
Bruder John
7249054da5 Merge branch 'main' into johns-branch 2024-05-08 14:21:14 +02:00
i22007
94c037467e Fixed write bytecode into file 2024-05-08 14:07:16 +02:00
Bruder John
f60fa05153 Merge branch 'main' into johns-branch 2024-05-08 13:34:09 +02:00
Bruder John
a98cb26083 first change 2024-05-08 13:33:20 +02:00
Bruder John
2539b7cff1 Merge branch 'main' into johns-branch 2024-05-08 11:50:18 +02:00
Bruder John
5344b01384 Merge branch 'main' into johns-branch 2024-05-08 11:41:45 +02:00
Bruder John
6e8079807a Added Typchecker and Semantic analyzer 2024-05-08 11:41:38 +02:00
219 changed files with 14136 additions and 1986 deletions

15
.gitea/workflows/test.yml Normal file
View File

@@ -0,0 +1,15 @@
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Run the Maven verify phase
run: mvn --batch-mode --update-snapshots verify

9
.gitignore vendored
View File

@@ -76,4 +76,11 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
/target
/target
src/main/resources/logs/miniCompilerLog.log
src/test/java/main/CompilerInput.class
src/test/resources/output/javac/CompilerInput$Test.class
src/test/resources/output/javac/CompilerInput.class
src/test/resources/output/miniCompiler/CompilerInput.class
src/test/resources/output/miniCompiler/CompilerInput$Test.class
.idea/inspectionProfiles/Project_Default.xml

19
.idea/ANTLRv4ToolGrammarProperties.xml generated Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ANTLRv4ToolGrammarProperties">
<option name="perGrammarGenerationSettings">
<list>
<PerGrammarGenerationSettings>
<option name="fileName" value="$PROJECT_DIR$/src/main/java/parser/grammar/SimpleJava.g4" />
<option name="autoGen" value="true" />
<option name="outputDir" value="C:\Users\janni\Desktop\NichtHaskell2.0\src\main\java" />
<option name="libDir" value="" />
<option name="encoding" value="" />
<option name="pkg" value="parser.generated" />
<option name="language" value="" />
<option name="generateVisitor" value="true" />
</PerGrammarGenerationSettings>
</list>
</option>
</component>
</project>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@@ -6,6 +6,11 @@
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="maven_central" />
<option name="name" value="Maven Central" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />

16
.idea/misc.xml generated
View File

@@ -6,10 +6,20 @@
<PerGrammarGenerationSettings>
<option name="fileName" value="$PROJECT_DIR$/src/main/java/parser/SimpleJava.g4" />
<option name="autoGen" value="true" />
<option name="outputDir" value="C:\Users\ARB00075\Documents\DH\Compilerbau\NichtHaskell2.0\src\main\java\parser\out" />
<option name="outputDir" value="C:\Users\ARB00075\Documents\DH\Compilerbau\NichtHaskell2.0\src\main\java" />
<option name="libDir" value="" />
<option name="encoding" value="" />
<option name="pkg" value="" />
<option name="pkg" value="parser.generated" />
<option name="language" value="" />
<option name="generateVisitor" value="true" />
</PerGrammarGenerationSettings>
<PerGrammarGenerationSettings>
<option name="fileName" value="$PROJECT_DIR$/src/main/java/parser/grammar/SimpleJava.g4" />
<option name="autoGen" value="true" />
<option name="outputDir" value="C:\Users\Maxi\Documents\DHBW\Compilerbau\NichtHaskell2.0\src\main\java" />
<option name="libDir" value="" />
<option name="encoding" value="" />
<option name="pkg" value="parser.generated" />
<option name="language" value="" />
<option name="generateVisitor" value="true" />
</PerGrammarGenerationSettings>
@@ -40,7 +50,7 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" default="true" project-jdk-name="openjdk-22" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

Binary file not shown.

37
Makefile Normal file
View File

@@ -0,0 +1,37 @@
### IntelliJs play buttons do not work. Run in "src/test" folder with "make" command to run all
### Or run only parts with "make compile-javac", "make clean" etc.
all: compile-javac compile-miniCompiler
compile-javac:
#javac -d src/test/resources/output/javac src/test/resources/input/CompilerInput.java
compile-miniCompiler:
cd ../.. ; mvn -DskipTests install
cd ../.. ; mvn exec:java -DgenJar=true -DgenClass=true -Dexec.mainClass="main.Main" -Dexec.args="'src/main/resources/input/CompilerInput.java' 'src/main/resources/output'"
# cp src/main/resources/output/CompilerInput.class src/test/resources/output/miniCompiler
test-miniCompiler:
# move the compiled class to the test/main folder
mv src/main/resources/output/CompilerInput.class src/test/java/main/
# compile the test class
javac src/test/java/main/EndToEndTester.java
# run the test class
java -cp src/test/java/main EndToEndTester
clean:
# clean main output folders
rm -f src/main/resources/output/*.class
rm -f src/main/resources/output/*.jar
# clean resources output folders
rm -f src/test/resources/output/javac/*.class
rm -f src/test/resources/output/miniCompiler/*.class
rm -f src/test/resources/output/miniCompiler/*.jar
# clean logs
rm -f src/main/resources/logs/*
# clean test/java/main folders from .class files for End-to-End tests
rm -f src/test/java/main/*.class
# clean javac output from every folder
rm -f src/test/resources/input/*/*.class
# clean test results from maven surefire plugin
rm -f ../../target/surefire-reports/*.txt

BIN
Parser_Dokumentation.pdf Normal file

Binary file not shown.

136
README.md Normal file
View File

@@ -0,0 +1,136 @@
# "Nicht Haskel 2.0" Java Compiler
Realisation of a subset of the Java Standard Compiler in the course Compiler Construction of the 4th semester Computer Science at the Duale Hochschule Stuttgart (Horb).
This project aims to provide a simplified version of the Java compiler, focusing on key language features and demonstrating the principles of compiler construction.
## Realised Java syntax
- **Data types**: `int`, `boolean`, `char`
- **Access modifier**: `public`, `protected`, `private`
- **Operators**: `=` `+` `-` `*` `%` `/` `>` `<` `>=` `<=` `==` `!=` `!` `&&` `||` `++` `--`
- **Keywords**: `class`, `this`, `while`, `do`, `if`, `else`, `for`, `return`, `new`, `switch`, `case`, `break`, `default`, `:`
- **Statements**:
- `if` ... `if else` ... `else`;
- `while` ... ;
- `do` ... `while`;
- `for`;
- **Comments**:
- Single line: `// comment`
- Multi-line: `/* comment */`
- **Further functions**:
- All methods are overloadable
- High maintainability and expandability through implementation of the visitor pattern
- Logging Input and Outputs
- Error Handling in the Semantic Check
## Project Structure
```plain
src/
└── main/
├── java/
│ ├── ast/ -> Defining the structure of the AST
│ ├── bytecode/ -> Generate Java bytecode
│ ├── main/ -> Running the compiler
│ ├── parser/
│ │ ├── astBuilder/ -> Builder creating the AST
│ │ ├── generated/ -> Antlr generated grammar
│ │ └── grammar/ -> Antlr grammar
│ ├── semantic/ -> Running the semantic check
│ └── visitor/ -> Visitor interface
└── resources/
test/
└── java/
│ ├── main/ -> Running E2E tests
│ ├── parser/ -> Performs tests on the parser
│ ├── semantic/ -> Performs tests on the semantic check
└── resources/ -> Ressources for running the Tests
```
## Class-Diagramm AST
![AST Diagramm](ast.png)
## Distribution of the realisation
### i22030 & i22035
Ausführliche Beschreibung der Parser Umsetzung:
![Parserumsetzung](Parser_Dokumentation.pdf)
Parser:
- Grammar -> (src/main/java/parser/grammar)
- Scanner
- Parser
- Abstract Syntax Tree (AST) -> (src/main/java/ast)
- AstBuilder -> (src/main/java/parser/astBuilder)
Parser tests:
- ParserTests -> (src/test/java/parser)
- TestCases -> (src/test/resources/input/singeFeatureTests)
Other:
- Documentation -> (README.md)
- Ast Class-Diagramm -> (ast.png)
- PowerPoint
### i22005
Semantic check:
- Set all types and check whether types have been used correctly
- Contexts -> (src/main/java/semantic/context)
- Exceptions Handling -> (src/main/java/semantic/exceptions)
Semantic Tests:
- Typing and Type checking -> (src/test/java/semantic/EndToTypedAstTest)
- Exception and feature test -> (src/test/resources/input/typedAstExceptionsTests)
### i22007
Bytecode generation:
- Complete bytecode generation -> (src/mein/java/bytecode)
### i22011
Tests and execution:
- Makefile
- Running Compiler -> (src/main/main)
- Running E2E tests -> (src/test/main)
- Typing and Type checking -> (src/test/java/semantic/EndToTypedAstTest)
## Used Tools
- [Maven 4.0](https://maven.apache.org/index.html)
- Used for automating the build process and managing dependencies.
- [ANTLR4 v.13.1](https://www.antlr.org/)
- Used to parse the input Java code into the Abstract Syntax Tree.
## How to run the compiler
### Possibilities
### 1. Start miniCompiler using make:
Make needs to be installed
```bash
cd .\src\test\ ; make clean compile-miniCompiler
```
### 2. Start miniCompiler using jar:
If you do not have the .jar, download it [here](https://gitea.hb.dhbw-stuttgart.de/i22005/NichtHaskell2.0/src/branch/main/JavaCompiler-1.0-jar-with-dependencies.jar) or compile it using mvn package or make first
```
java.exe -DgenJar=bool -DgenClass=bool -jar path_to_jar\jarName.jar 'path_to_input_file.java' 'path_to_output_directory'
```
Example (jar needs to be in the target directory)
```bash
java.exe -DgenJar=true -DgenClass=true -jar .\target\JavaCompiler-1.0-jar-with-dependencies.jar 'src/main/resources/input/CompilerInput.java' 'src/main/resources/output'
```
- set DgenJar true, to generate the jar, false for no jar
```
DgenJar=true
```
- set DgenClass true, to generate class files, false for no class files
```
DgenClass=true
```

Binary file not shown.

BIN
ast.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

77
pom.xml
View File

@@ -4,13 +4,14 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<groupId>de.dhbw-stuttgart</groupId>
<artifactId>JavaCompiler</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<java.version>22</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
@@ -19,7 +20,25 @@
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.9.3</version> <!-- Change the version as needed -->
<version>5.11.0-M2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-engine</artifactId>
<version>1.11.0-M2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.11.0-M2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -27,13 +46,22 @@
<artifactId>antlr4-runtime</artifactId>
<version>4.13.1</version>
</dependency>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.7</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.16.0</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.26.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@@ -43,8 +71,41 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version> <!-- Change the version as needed -->
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<mainClass>main.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>maven_central</id>
<name>Maven Central</name>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
</project>

View File

@@ -1,3 +0,0 @@
public class Example() {
}

View File

@@ -1,45 +0,0 @@
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import parser.ASTBuilder;
import ast.ClassNode;
import ast.ProgramNode;
import bytecode.ByteCodeGenerator;
import java.io.IOException;
import java.nio.file.Paths;
public class Main {
public static void main(String[] args) throws Exception {
CharStream codeCharStream = null;
try {
codeCharStream = CharStreams.fromPath(Paths.get("src/main/java/Example.java"));
parsefile(codeCharStream);
} catch (IOException e) {
System.err.println("Error reading the file: " + e.getMessage());
}
}
static void parsefile(CharStream codeCharStream){
// CharStream codeCharStream = CharStreams.fromString("class Example { } class Example2 { }");
SimpleJavaLexer lexer = new SimpleJavaLexer(codeCharStream);
CommonTokenStream tokens = new CommonTokenStream(lexer);
SimpleJavaParser parser = new SimpleJavaParser(tokens);
ParseTree tree = parser.program(); // parse the input
ASTBuilder builder = new ASTBuilder();
ProgramNode ast = (ProgramNode) builder.visit(tree); // build the AST
// Optionally print or process the AST
System.out.println("Parsed " + ast.classes.size() + " classes with identifiers/names:");
for (ClassNode classNode : ast.classes) {
System.out.println(classNode.name);
}
ByteCodeGenerator byteCodeGenerator = new ByteCodeGenerator();
byteCodeGenerator.generateByteCode(ast);
}
}

View File

@@ -1,8 +1,6 @@
package ast;
import java.util.ArrayList;
import java.util.List;
public abstract class ASTNode { }
public interface ASTNode {
}

View File

@@ -1,9 +0,0 @@
package ast;
public class AccessTypeNode extends ASTNode {
public EnumAccessTypeNode enumAccessTypeNode;
public AccessTypeNode(EnumAccessTypeNode enumAccessTypeNode) {
this.enumAccessTypeNode = enumAccessTypeNode;
}
}

View File

@@ -1,30 +1,52 @@
package ast;
import ast.type.AccessModifierNode;
import ast.members.MemberNode;
import ast.members.MethodNode;
import bytecode.visitor.ClassVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
import java.util.ArrayList;
import java.util.List;
public class ClassNode extends ASTNode{
public AccessTypeNode accessType;
public String name;
public class ClassNode implements ASTNode, Visitable {
public AccessModifierNode accessType;
public String identifier;
public List<MemberNode> members = new ArrayList<>();
public boolean hasConstructor = false;
public ClassNode(AccessTypeNode accessType, String name){
this.accessType = accessType;
this.name = name;
public ClassNode() {
}
public ClassNode(String accessType, String identifier) {
this.accessType = new AccessModifierNode(accessType);
this.identifier = identifier;
}
public void addMember(MemberNode member) {
if (member instanceof ConstructorNode) {
this.hasConstructor = true;
}
members.add(member);
}
public void ensureConstructor(){
if(!hasConstructor) {
ConstructorNode constructor = new ConstructorNode(new AccessTypeNode(EnumAccessTypeNode.PUBLIC), name);
members.add(0,constructor);
public List<MethodNode> getMethods() {
List<MethodNode> methods = new ArrayList<>();
for (MemberNode member : members) {
if (member instanceof MethodNode methodNode) {
methods.add(methodNode);
}
}
return methods;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(ClassVisitor classVisitor) {
classVisitor.visit(this);
}
}

View File

@@ -1,7 +0,0 @@
package ast;
public class ConstructorNode extends MethodNode{
public ConstructorNode(AccessTypeNode visibility, String name) {
super(visibility, name);
}
}

View File

@@ -1,5 +0,0 @@
package ast;
public enum EnumAccessTypeNode {
PUBLIC, PRIVATE
}

View File

@@ -1,5 +0,0 @@
package ast;
public enum EnumTypeNode {
INT, BOOLEAN, CHAR
}

View File

@@ -1,4 +0,0 @@
package ast;
public class ExpressionNode {
}

View File

@@ -1,14 +0,0 @@
package ast;
public class FieldNode extends MemberNode {
public AccessTypeNode accessTypeNode;
public TypeNode type;
public String name;
public FieldNode(AccessTypeNode accessTypeNode, TypeNode type, String name){
this.accessTypeNode = accessTypeNode;
this.type = type;
this.name = name;
}
}

View File

@@ -1,4 +0,0 @@
package ast;
public class MemberNode extends ASTNode{
}

View File

@@ -1,28 +0,0 @@
package ast;
import java.util.ArrayList;
import java.util.List;
public class MethodNode extends MemberNode{
public AccessTypeNode visibility;
public TypeNode type;
public String name;
public ParameterListNode parameters;
public List<StatementNode> statements = new ArrayList<>();
public MethodNode(AccessTypeNode visibility, TypeNode type, String name, ParameterListNode parameters,
List<StatementNode> statements){
this.visibility = visibility;
this.type = type;
this.name = name;
this.parameters = parameters;
this.statements = statements;
}
public MethodNode(AccessTypeNode visibility, String name){
this.visibility = visibility;
this.name = name;
}
}

View File

@@ -1,12 +0,0 @@
package ast;
import java.util.ArrayList;
import java.util.List;
public class ParameterListNode extends ASTNode {
List<ParameterNode> parameters = new ArrayList<>();
public ParameterListNode(List<ParameterNode> parameters){
this.parameters = parameters;
}
}

View File

@@ -1,11 +0,0 @@
package ast;
public class ParameterNode extends ASTNode {
public TypeNode type;
public String identifier;
public ParameterNode(TypeNode type, String identifier) {
this.type = type;
this.identifier = identifier;
}
}

View File

@@ -1,12 +1,27 @@
package ast;
import bytecode.visitor.ProgramVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
import java.util.ArrayList;
import java.util.List;
public class ProgramNode extends ASTNode {
public class ProgramNode implements ASTNode, Visitable {
public List<ClassNode> classes = new ArrayList<>();
public void addClass(ClassNode classNode) {
classes.add(classNode);
}
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(ProgramVisitor programVisitor) {
programVisitor.visit(this);
}
}

View File

@@ -1,7 +0,0 @@
package ast;
import ast.ASTNode;
public abstract class StatementNode extends ASTNode {
}

View File

@@ -1,9 +0,0 @@
package ast;
public class TypeNode extends ASTNode {
public EnumTypeNode enumTypeNode;
public TypeNode(EnumTypeNode enumTypeNode) {
this.enumTypeNode = enumTypeNode;
}
}

View File

@@ -1,13 +0,0 @@
package ast;
public class VariableDeclarationStatementNode extends StatementNode {
public TypeNode type;
public String identifier;
public ExpressionNode expression; // Nullable for cases without initialization
public VariableDeclarationStatementNode(TypeNode type, String identifier, ExpressionNode expression) {
this.type = type;
this.identifier = identifier;
this.expression = expression;
}
}

View File

@@ -0,0 +1,13 @@
package ast.expressions;
import ast.ASTNode;
import ast.type.type.ITypeNode;
import visitor.Visitable;
public interface IExpressionNode extends ASTNode, Visitable {
ITypeNode getType();
void setType(ITypeNode type);
}

View File

@@ -0,0 +1,33 @@
package ast.expressions.binaryexpressions;
import ast.expressions.IExpressionNode;
import ast.type.type.*;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
public class BinaryNode implements IExpressionNode, Visitable {
public ITypeNode typeNode;
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public ITypeNode getType() {
return typeNode;
}
@Override
public void setType(ITypeNode type) {
this.typeNode = type;
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,43 @@
package ast.expressions.binaryexpressions;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class CalculationNode extends BinaryNode {
public CalculationNode calculationExpression;
public EnumLineOperator operator;
public DotNode dotExpression;
public CalculationNode(CalculationNode calculationExpression, String operator, DotNode dotExpression) {
this.calculationExpression = calculationExpression;
setOperator(operator);
this.dotExpression = dotExpression;
}
public CalculationNode(DotNode dotExpression) {
this.dotExpression = dotExpression;
}
public void setOperator(String operator) {
if (operator != null) {
if (operator.equals("+")) {
this.operator = EnumLineOperator.PLUS;
} else if (operator.equals("-")) {
this.operator = EnumLineOperator.MINUS;
}
}
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,40 @@
package ast.expressions.binaryexpressions;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class DotNode extends BinaryNode {
public DotNode dotExpression;
public EnumDotOperator operator;
public DotSubtractionNode dotSubtractionExpression;
public DotNode(DotNode dotExpression, String operator, DotSubtractionNode dotSubtractionExpression) {
this.dotExpression = dotExpression;
setOperator(operator);
this.dotSubtractionExpression = dotSubtractionExpression;
}
public DotNode(DotSubtractionNode dotSubtractionExpression) {
this.dotSubtractionExpression = dotSubtractionExpression;
}
public void setOperator(String operator) {
switch (operator) {
case "*" -> this.operator = EnumDotOperator.MULT;
case "/" -> this.operator = EnumDotOperator.DIV;
case "%" -> this.operator = EnumDotOperator.MOD;
}
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,44 @@
package ast.expressions.binaryexpressions;
import ast.expressions.unaryexpressions.MemberAccessNode;
import ast.statementexpressions.methodcallstatementnexpressions.MethodCallNode;
import ast.type.ValueNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class DotSubtractionNode extends BinaryNode {
public ValueNode value;
public String identifier;
public MemberAccessNode memberAccess;
public MethodCallNode methodCall;
public CalculationNode calculationExpression;
public DotSubtractionNode(ValueNode value) {
this.value = value;
}
public DotSubtractionNode(String identifier) {
this.identifier = identifier;
}
public DotSubtractionNode(MemberAccessNode memberAccess) {
this.memberAccess = memberAccess;
}
public DotSubtractionNode(MethodCallNode methodCall, CalculationNode calculationExpression) {
this.methodCall = methodCall;
this.calculationExpression = calculationExpression;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,5 @@
package ast.expressions.binaryexpressions;
public enum EnumDotOperator {
MULT, DIV, MOD
}

View File

@@ -0,0 +1,5 @@
package ast.expressions.binaryexpressions;
public enum EnumLineOperator {
PLUS, MINUS
}

View File

@@ -0,0 +1,5 @@
package ast.expressions.binaryexpressions;
public enum EnumNonCalculationOperator {
AND, OR, GREATER, LESS, GREATER_EQUAL, LESS_EQUAL, EQUAL, NOT_EQUAL
}

View File

@@ -0,0 +1,43 @@
package ast.expressions.binaryexpressions;
import ast.expressions.IExpressionNode;
import ast.expressions.unaryexpressions.UnaryNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class NonCalculationNode extends BinaryNode {
public UnaryNode unaryExpression;
public EnumNonCalculationOperator operator;
public IExpressionNode expression;
public NonCalculationNode(UnaryNode unaryExpression, String operator, IExpressionNode expression) {
this.unaryExpression = unaryExpression;
setOperator(operator);
this.expression = expression;
}
public void setOperator(String operator) {
switch (operator) {
case "&&" -> this.operator = EnumNonCalculationOperator.AND;
case "||" -> this.operator = EnumNonCalculationOperator.OR;
case ">" -> this.operator = EnumNonCalculationOperator.GREATER;
case "<" -> this.operator = EnumNonCalculationOperator.LESS;
case ">=" -> this.operator = EnumNonCalculationOperator.GREATER_EQUAL;
case "<=" -> this.operator = EnumNonCalculationOperator.LESS_EQUAL;
case "==" -> this.operator = EnumNonCalculationOperator.EQUAL;
case "!=" -> this.operator = EnumNonCalculationOperator.NOT_EQUAL;
}
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,45 @@
package ast.expressions.unaryexpressions;
import ast.ASTNode;
import ast.type.type.ITypeNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
import java.util.ArrayList;
import java.util.List;
public class MemberAccessNode implements ASTNode, Visitable {
public Boolean thisExpr;
public List<String> identifiers = new ArrayList<>();
private ITypeNode typeNode;
public MemberAccessNode(Boolean thisExpr) {
this.thisExpr = thisExpr;
}
public void addIdentifier(String identifier) {
identifiers.add(identifier);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
public ITypeNode getTypeNode() {
return typeNode;
}
public void setTypeNode(ITypeNode typeNode) {
this.typeNode = typeNode;
}
}

View File

@@ -0,0 +1,35 @@
package ast.expressions.unaryexpressions;
import ast.expressions.IExpressionNode;
import ast.type.type.ITypeNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class NotNode implements IExpressionNode {
public IExpressionNode expression;
public NotNode(IExpressionNode expression) {
this.expression = expression;
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return null;
}
@Override
public ITypeNode getType() {
return expression.getType();
}
@Override
public void setType(ITypeNode type) {
this.expression.setType(type);
}
}

View File

@@ -0,0 +1,70 @@
package ast.expressions.unaryexpressions;
import ast.expressions.IExpressionNode;
import ast.statements.IStatementNode;
import ast.type.type.*;
import ast.type.ValueNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import java.util.Objects;
public class UnaryNode implements IExpressionNode {
public String thisExp;
public String identifier;
public MemberAccessNode memberAccess;
public ValueNode value;
public NotNode notExpression;
public IStatementNode statement;
public IExpressionNode expression;
public ITypeNode type;
public UnaryNode(String value) {
if (Objects.equals(value, "this")) {
this.thisExp = "this";
} else {
this.identifier = value;
}
}
public UnaryNode(MemberAccessNode memberAccess) {
this.memberAccess = memberAccess;
}
public UnaryNode(ValueNode value) {
this.value = value;
}
public UnaryNode(NotNode notExpression) {
this.notExpression = notExpression;
}
public UnaryNode(IStatementNode statement) {
this.statement = statement;
}
public UnaryNode(IExpressionNode expression) {
this.expression = expression;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public ITypeNode getType() {
return type;
}
public void setType(ITypeNode type) {
this.type = type;
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,41 @@
package ast.members;
import ast.parameters.ParameterNode;
import ast.statements.BlockNode;
import ast.type.AccessModifierNode;
import bytecode.visitor.MethodVisitor;
import visitor.Visitable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class ConstructorNode extends MethodNode implements Visitable {
public ConstructorNode(String accessType, String identifier, BlockNode block) {
this.accesModifier = new AccessModifierNode(accessType);
this.identifier = identifier;
this.block = block;
}
public void addParameter(ParameterNode parameterNode) {
parameters.add(parameterNode);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
public boolean isSame(MethodNode methodNode) {
if (!(Objects.equals(this.identifier, methodNode.getIdentifier())) || getParameters().size() != methodNode.getParameters().size()) {
return false;
}
for (int i = 0; i < this.getParameters().size(); i++) {
if (!this.getParameters().get(i).type.equals(methodNode.getParameters().get(i).type)) {
return false;
}
}
return true;
}
}

View File

@@ -0,0 +1,31 @@
package ast.members;
import ast.type.AccessModifierNode;
import ast.type.type.ITypeNode;
import bytecode.visitor.ClassVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
public class FieldNode implements MemberNode, Visitable {
public AccessModifierNode accessTypeNode;
public ITypeNode type;
public String identifier;
public FieldNode(AccessModifierNode accessTypeNode, ITypeNode type, String name) {
this.accessTypeNode = accessTypeNode;
this.type = type;
this.identifier = name;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(ClassVisitor classVisitor) {
classVisitor.visit(this);
}
}

View File

@@ -0,0 +1,17 @@
package ast.members;
import ast.statements.BlockNode;
import bytecode.visitor.MethodVisitor;
import visitor.Visitable;
public class MainMethodNode extends MethodNode implements Visitable {
public MainMethodNode(BlockNode block) {
this.block = block;
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,17 @@
package ast.members;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import ast.ASTNode;
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY)
@JsonSubTypes({
@JsonSubTypes.Type(value = MethodNode.class, name = "Method"),
@JsonSubTypes.Type(value = FieldNode.class, name = "Field")}
)
public interface MemberNode extends ASTNode {
}

View File

@@ -0,0 +1,83 @@
package ast.members;
import ast.parameters.ParameterNode;
import ast.statements.BlockNode;
import ast.type.AccessModifierNode;
import ast.type.type.*;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
public class MethodNode implements MemberNode, Visitable {
public AccessModifierNode accesModifier;
public ITypeNode type;
public Boolean voidType;
public String identifier;
public List<ParameterNode> parameters = new ArrayList<>();
public BlockNode block;
public MethodNode() {
}
public MethodNode(String accessModifier, ITypeNode type, Boolean voidType, String identifier, BlockNode block) {
this.accesModifier = new AccessModifierNode(accessModifier);
this.type = type;
this.voidType = voidType;
this.identifier = identifier;
this.block = block;
}
public void addParameter(ParameterNode parameter) {
this.parameters.add(parameter);
}
public List<ParameterNode> getParameters() {
return parameters;
}
public boolean isSame(MethodNode methodNode) {
if (!(Objects.equals(this.identifier, methodNode.getIdentifier())) || type.equals(methodNode.type)
|| getParameters().size() != methodNode.getParameters().size()) {
return false;
}
for (int i = 0; i < this.getParameters().size(); i++) {
if (!this.getParameters().get(i).type.equals(methodNode.getParameters().get(i).type)) {
return false;
}
}
return true;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
public String getIdentifier() {
return identifier;
}
public ITypeNode getType() {
return type;
}
public void setType(ITypeNode type) {
this.type = type;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
}

View File

@@ -0,0 +1,23 @@
package ast.parameters;
import ast.ASTNode;
import ast.type.type.*;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
public class ParameterNode implements ASTNode, Visitable {
public ITypeNode type;
public String identifier;
public ParameterNode(ITypeNode type, String identifier) {
this.type = type;
this.identifier = identifier;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
}

View File

@@ -0,0 +1,27 @@
package ast.statementexpressions;
import ast.expressions.IExpressionNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class AssignNode implements IStatementExpressionNode {
public AssignableNode assignable;
public IExpressionNode expression;
public AssignNode(AssignableNode assignable, IExpressionNode expression) {
this.assignable = assignable;
this.expression = expression;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,32 @@
package ast.statementexpressions;
import ast.expressions.unaryexpressions.MemberAccessNode;
import ast.type.type.ITypeNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class AssignableNode implements IStatementExpressionNode {
public String identifier;
public ITypeNode typeNode;
public MemberAccessNode memberAccess;
public AssignableNode(String identifier) {
this.identifier = identifier;
}
public AssignableNode(MemberAccessNode memberAccess) {
this.memberAccess = memberAccess;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
public void setTypeNode(ITypeNode typeNode) {
this.typeNode = typeNode;
}
}

View File

@@ -0,0 +1,6 @@
package ast.statementexpressions;
import ast.statements.IStatementNode;
public interface IStatementExpressionNode extends IStatementNode {
}

View File

@@ -0,0 +1,33 @@
package ast.statementexpressions;
import ast.expressions.IExpressionNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import java.util.ArrayList;
import java.util.List;
public class NewDeclarationNode implements IStatementExpressionNode {
public String identifier;
public List<IExpressionNode> expressions = new ArrayList<>();
public NewDeclarationNode(String identifier) {
this.identifier = identifier;
}
public void addExpression(IExpressionNode expression) {
expressions.add(expression);
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,5 @@
package ast.statementexpressions.crementexpressions;
public enum CrementType {
PREFIX, SUFFIX
}

View File

@@ -0,0 +1,28 @@
package ast.statementexpressions.crementexpressions;
import ast.statementexpressions.AssignableNode;
import ast.statementexpressions.IStatementExpressionNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
public class DecrementNode implements IStatementExpressionNode, Visitable {
public CrementType crementType;
public AssignableNode assignableExpression;
public DecrementNode(CrementType crementType, AssignableNode assignableExpression) {
this.crementType = crementType;
this.assignableExpression = assignableExpression;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,28 @@
package ast.statementexpressions.crementexpressions;
import ast.statementexpressions.AssignableNode;
import ast.statementexpressions.IStatementExpressionNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import visitor.Visitable;
import semantic.TypeCheckResult;
public class IncrementNode implements IStatementExpressionNode, Visitable {
public CrementType crementType;
public AssignableNode assignableExpression;
public IncrementNode(CrementType crementType, AssignableNode assignableExpression) {
this.crementType = crementType;
this.assignableExpression = assignableExpression;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,29 @@
package ast.statementexpressions.methodcallstatementnexpressions;
import ast.ASTNode;
import ast.expressions.IExpressionNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
import java.util.ArrayList;
import java.util.List;
public class ChainedMethodNode implements ASTNode, Visitable {
public String identifier;
public List<IExpressionNode> expressions = new ArrayList<>();
public ChainedMethodNode(String identifier) {
this.identifier = identifier;
}
public void addExpression(IExpressionNode expression) {
expressions.add(expression);
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return null;
}
}

View File

@@ -0,0 +1,43 @@
package ast.statementexpressions.methodcallstatementnexpressions;
import ast.expressions.IExpressionNode;
import ast.statements.IStatementNode;
import ast.type.type.ITypeNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import java.util.ArrayList;
import java.util.List;
public class MethodCallNode implements IStatementNode {
public TargetNode target;
public ITypeNode type;
public List<ChainedMethodNode> chainedMethods = new ArrayList<>();
public String identifier;
public List<IExpressionNode> parameters = new ArrayList<>();
public MethodCallNode(TargetNode target, String identifier) {
this.target = target;
this.identifier = identifier;
}
public void addChainedMethod(ChainedMethodNode chainedMethode) {
chainedMethods.add(chainedMethode);
}
public void addExpression(IExpressionNode parameter) {
parameters.add(parameter);
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,37 @@
package ast.statementexpressions.methodcallstatementnexpressions;
import ast.ASTNode;
import ast.expressions.unaryexpressions.MemberAccessNode;
import ast.statementexpressions.NewDeclarationNode;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
public class TargetNode implements ASTNode, Visitable {
public Boolean thisTar;
public MemberAccessNode memberAccess;
public NewDeclarationNode newDeclaration;
public String identifier;
public TargetNode(Boolean thisTar) {
this.thisTar = thisTar;
}
public TargetNode(MemberAccessNode memberAccess) {
this.memberAccess = memberAccess;
}
public TargetNode(NewDeclarationNode newDeclaration) {
this.newDeclaration = newDeclaration;
}
public TargetNode(String identifier) {
this.identifier = identifier;
}
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
}

View File

@@ -0,0 +1,31 @@
package ast.statements;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
import java.util.ArrayList;
import java.util.List;
public class BlockNode implements IStatementNode, Visitable {
public List<IStatementNode> statements = new ArrayList<>();
public BlockNode() {
}
public void addStatement(IStatementNode statement) {
statements.add(statement);
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,19 @@
package ast.statements;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class ElseNode implements IStatementNode {
public BlockNode block;
public ElseNode(BlockNode block) {
this.block = block;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
}

View File

@@ -0,0 +1,7 @@
package ast.statements;
import ast.ASTNode;
import visitor.Visitable;
public interface IStatementNode extends ASTNode, Visitable {
}

View File

@@ -0,0 +1,33 @@
package ast.statements;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import java.util.ArrayList;
import java.util.List;
public class IfElseNode implements IStatementNode {
public IfNode ifStatement;
public List<IfNode> elseIfStatements = new ArrayList<>();
public ElseNode elseStatement;
public IfElseNode(IfNode ifStatement, ElseNode elseNode) {
this.ifStatement = ifStatement;
this.elseStatement = elseNode;
}
public void addElseIfStatement(IfNode elseIfStament) {
elseIfStatements.add(elseIfStament);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
}

View File

@@ -0,0 +1,20 @@
package ast.statements;
import ast.expressions.IExpressionNode;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class IfNode implements IStatementNode {
public IExpressionNode expression;
public BlockNode block;
public IfNode(IExpressionNode expression, BlockNode block) {
this.expression = expression;
this.block = block;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
}

View File

@@ -0,0 +1,32 @@
package ast.statements;
import ast.expressions.IExpressionNode;
import ast.type.type.*;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class LocalVariableDeclarationNode implements IStatementNode {
public ITypeNode type;
public String identifier;
public String assign;
public IExpressionNode expression;
public LocalVariableDeclarationNode(ITypeNode type, String identifier, String assign, IExpressionNode expression) {
this.type = type;
this.identifier = identifier;
this.assign = assign;
this.expression = expression;
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,30 @@
package ast.statements;
import ast.expressions.IExpressionNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class ReturnNode implements IStatementNode {
public IExpressionNode expression;
public Boolean voidReturn = false;
public ReturnNode(IExpressionNode expression) {
if (expression != null) {
this.expression = expression;
} else {
voidReturn = true;
}
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
}

View File

@@ -0,0 +1,30 @@
package ast.statements;
import ast.expressions.IExpressionNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
public class WhileNode implements IStatementNode {
public IExpressionNode expression;
public BlockNode block;
public WhileNode(IExpressionNode expression, BlockNode block) {
this.expression = expression;
this.block = block;
}
public void test() {
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
}

View File

@@ -0,0 +1,28 @@
package ast.type;
public class AccessModifierNode {
public EnumAccessModifierNode accessType;
public AccessModifierNode(String accessModifier) {
setModifier(accessModifier);
}
private void setModifier(String accessType) {
switch (accessType) {
case "public":
this.accessType = EnumAccessModifierNode.PUBLIC;
break;
case "public static":
this.accessType = EnumAccessModifierNode.PUBLIC_STATIC;
break;
case "private":
this.accessType = EnumAccessModifierNode.PRIVATE;
break;
case "private static":
this.accessType = EnumAccessModifierNode.PRIVATE_STATIC;
break;
default:
this.accessType = null;
}
}
}

View File

@@ -0,0 +1,6 @@
package ast.type;
public enum EnumAccessModifierNode {
PUBLIC, PRIVATE, PUBLIC_STATIC, PRIVATE_STATIC
}

View File

@@ -0,0 +1,5 @@
package ast.type;
public enum EnumValueNode {
INT_VALUE, BOOLEAN_VALUE, CHAR_VALUE, NULL_VALUE
}

View File

@@ -0,0 +1,27 @@
package ast.type;
import ast.ASTNode;
import bytecode.visitor.MethodVisitor;
import semantic.SemanticVisitor;
import semantic.TypeCheckResult;
import visitor.Visitable;
public class ValueNode implements ASTNode, Visitable {
public EnumValueNode valueType;
public String value;
public ValueNode(EnumValueNode valueType, String value) {
this.valueType = valueType;
this.value = value;
}
@Override
public void accept(MethodVisitor methodVisitor) {
methodVisitor.visit(this);
}
@Override
public TypeCheckResult accept(SemanticVisitor visitor) {
return visitor.analyze(this);
}
}

View File

@@ -0,0 +1,26 @@
package ast.type.type;
public class BaseType implements ITypeNode {
public final TypeEnum typeEnum;
public BaseType(TypeEnum typeEnum) {
this.typeEnum = typeEnum;
}
public TypeEnum getTypeEnum() {
return typeEnum;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BaseType other = (BaseType) obj;
return typeEnum == other.typeEnum;
}
}

View File

@@ -0,0 +1,4 @@
package ast.type.type;
public interface ITypeNode {
}

View File

@@ -0,0 +1,30 @@
package ast.type.type;
public class ReferenceType implements ITypeNode {
public final String identifier;
public ReferenceType(String identifier) {
this.identifier = identifier;
}
public String getIdentifier() {
return identifier;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ReferenceType other = (ReferenceType) obj;
if (identifier == null) {
return other.identifier == null;
} else return identifier.equals(other.identifier);
}
}

View File

@@ -0,0 +1,9 @@
package ast.type.type;
public enum TypeEnum {
VOID,
INT,
CHAR,
BOOL,
NULL
}

View File

@@ -2,13 +2,89 @@ package bytecode;
import ast.ProgramNode;
import ast.ClassNode;
import ast.members.MainMethodNode;
import ast.members.MemberNode;
import bytecode.visitor.ProgramVisitor;
public class ByteCodeGenerator {
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
public void generateByteCode(ProgramNode ast) {
for (ClassNode classDeclarationNode : ast.classes) {
ClassCodeGen classCodeGen = new ClassCodeGen();
classCodeGen.generateClassCode(classDeclarationNode);
public class ByteCodeGenerator implements ProgramVisitor {
private JarOutputStream jarOutputStream;
private ByteArrayOutputStream byteArrayOutputStream;
private final String outputDirectory;
private final boolean generateJar;
private final boolean generateClassFiles;
public ByteCodeGenerator(String outputDirectory, boolean generateJar, boolean generateClassFiles) {
this.outputDirectory = outputDirectory;
this.generateJar = generateJar;
this.generateClassFiles = generateClassFiles;
}
@Override
public void visit(ProgramNode programNode) {
if(generateJar) {
byteArrayOutputStream = new ByteArrayOutputStream();
try {
Manifest manifest = new Manifest();
manifest.getMainAttributes().putValue("Manifest-Version", "1.0");
boolean foundMainClass = false;
for (ClassNode classNode : programNode.classes) {
if (foundMainClass) {
break;
}
for (MemberNode memberNode : classNode.members) {
if (memberNode instanceof MainMethodNode) {
manifest.getMainAttributes().putValue("Main-Class", classNode.identifier);
foundMainClass = true;
break;
}
}
}
jarOutputStream = new JarOutputStream(byteArrayOutputStream, manifest);
} catch (IOException e) {
throw new RuntimeException(e);
}
for (ClassNode classDeclarationNode : programNode.classes) {
ClassCodeGen classCodeGen = new ClassCodeGen(jarOutputStream, outputDirectory, generateJar, generateClassFiles);
classDeclarationNode.accept(classCodeGen);
}
try {
jarOutputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
saveJarFile(byteArrayOutputStream.toByteArray(), "output.jar");
} else {
for (ClassNode classDeclarationNode : programNode.classes) {
ClassCodeGen classCodeGen = new ClassCodeGen(jarOutputStream, outputDirectory, generateJar, generateClassFiles);
classDeclarationNode.accept(classCodeGen);
}
}
}
private void saveJarFile(byte[] jarBytes, String jarFileName) {
File directory = new File(outputDirectory);
if (!directory.exists()) {
directory.mkdirs();
}
File jarFile = new File(directory, jarFileName);
try (FileOutputStream fos = new FileOutputStream(jarFile)) {
fos.write(jarBytes);
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

View File

@@ -1,41 +1,79 @@
package bytecode;
import ast.ClassNode;
import ast.FieldNode;
import ast.MemberNode;
import ast.MethodNode;
import ast.members.FieldNode;
import ast.members.MemberNode;
import ast.members.MethodNode;
import ast.type.type.BaseType;
import bytecode.visitor.ClassVisitor;
import java.io.File;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Opcodes;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
public class ClassCodeGen {
public void generateClassCode(ClassNode classNode) {
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
Mapper mapper = new Mapper();
classWriter.visit(Opcodes.V1_8, mapper.mapAccesTypeToOpcode(classNode.accessType), classNode.name, null,
public class ClassCodeGen implements ClassVisitor {
private final Mapper mapper;
private ClassWriter classWriter;
private final JarOutputStream jarOutputStream;
private final String outputDirectory;
private final boolean generateJar;
private final boolean generateClassFiles;
public ClassCodeGen(JarOutputStream jarOutputStream, String outputDirectory, boolean generateJar, boolean generateClassFiles) {
this.mapper = new Mapper();
this.jarOutputStream = jarOutputStream;
this.outputDirectory = outputDirectory;
this.generateJar = generateJar;
this.generateClassFiles = generateClassFiles;
}
@Override
public void visit(ClassNode classNode) {
classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
classWriter.visit(Opcodes.V1_5, mapper.mapAccessTypeToOpcode(classNode.accessType), classNode.identifier, null,
"java/lang/Object", null);
for (MemberNode memberNode : classNode.members) {
if (memberNode instanceof FieldNode) {
FieldCodeGen fieldCodeGen = new FieldCodeGen();
fieldCodeGen.generateFieldCode(classWriter, (FieldNode) memberNode);
visit((FieldNode) memberNode);
} else if (memberNode instanceof MethodNode) {
MethodCodeGen methodCodeGen = new MethodCodeGen();
methodCodeGen.generateMethodCode(classWriter, (MethodNode) memberNode);
MethodCodeGen methodCodeGen = new MethodCodeGen(classWriter);
((MethodNode) memberNode).accept(methodCodeGen);
}
}
classWriter.visitEnd();
printIntoClassFile(classWriter.toByteArray(), classNode.name);
if (generateJar) {
writeToJar(classWriter.toByteArray(), classNode.identifier);
}
if (generateClassFiles) {
printIntoClassFile(classWriter.toByteArray(), classNode.identifier, outputDirectory);
}
classWriter.visitEnd();
}
private void printIntoClassFile(byte[] byteCode, String name) {
String filePath = "./classFileOutput/" + name + ".class";
@Override
public void visit(FieldNode fieldNode) {
if (fieldNode.type instanceof BaseType) {
classWriter.visitField(mapper.mapAccessTypeToOpcode(fieldNode.accessTypeNode), fieldNode.identifier, mapper.getTypeChar((BaseType) fieldNode.type), null, null);
}
classWriter.visitEnd();
}
private void printIntoClassFile(byte[] byteCode, String name, String outputDirectory) {
File directory = new File(outputDirectory);
if (!directory.exists()) {
directory.mkdirs();
}
String filePath = outputDirectory + "/" + name + ".class";
try {
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
fileOutputStream.write(byteCode);
@@ -44,4 +82,15 @@ public class ClassCodeGen {
e.printStackTrace();
}
}
private void writeToJar(byte[] byteCode, String className) {
try {
JarEntry jarEntry = new JarEntry(className + ".class");
jarOutputStream.putNextEntry(jarEntry);
jarOutputStream.write(byteCode);
jarOutputStream.closeEntry();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@@ -1,14 +0,0 @@
package bytecode;
import ast.FieldNode;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Opcodes;
public class FieldCodeGen {
public void generateFieldCode(ClassWriter classWriter, FieldNode fieldNode) {
Mapper mapper = new Mapper();
FieldVisitor fieldVisitor = classWriter.visitField(mapper.mapAccesTypeToOpcode(fieldNode.accessTypeNode), fieldNode.name, "", null, null);
}
}

View File

@@ -1,17 +1,65 @@
package bytecode;
import ast.AccessTypeNode;
import ast.EnumAccessTypeNode;
import ast.parameters.ParameterNode;
import ast.type.*;
import ast.type.type.BaseType;
import ast.type.type.ITypeNode;
import ast.type.type.ReferenceType;
import ast.type.type.TypeEnum;
import org.objectweb.asm.Opcodes;
import java.util.List;
public class Mapper {
public int mapAccesTypeToOpcode(AccessTypeNode type) {
switch (type.enumAccessTypeNode) {
case EnumAccessTypeNode.PUBLIC:
public int mapAccessTypeToOpcode(AccessModifierNode accessModifierNode) {
switch (accessModifierNode.accessType) {
case EnumAccessModifierNode.PUBLIC:
return Opcodes.ACC_PUBLIC;
case EnumAccessTypeNode.PRIVATE:
case EnumAccessModifierNode.PRIVATE:
return Opcodes.ACC_PRIVATE;
case EnumAccessModifierNode.PUBLIC_STATIC:
return Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC;
case EnumAccessModifierNode.PRIVATE_STATIC:
return Opcodes.ACC_PRIVATE | Opcodes.ACC_STATIC;
}
return 0;
}
public String generateMethodDescriptor(ITypeNode type, List<ParameterNode> parameters) {
String descriptor = "(";
for (ParameterNode parameterNode : parameters) {
if(parameterNode.type instanceof BaseType) {
descriptor += getTypeChar((BaseType) parameterNode.type);
} else {
ReferenceType referenceType = (ReferenceType) parameterNode.type;
descriptor += "L" + referenceType.getIdentifier() + ";";
}
}
descriptor += ")";
if(type instanceof BaseType) {
descriptor += getTypeChar((BaseType) type);
} else if(type instanceof ReferenceType) {
descriptor += "L" + ((ReferenceType) type).getIdentifier() +";";
}
return descriptor;
}
public String getTypeChar(BaseType type) {
String typeChar = "";
switch (type.getTypeEnum()) {
case TypeEnum.INT:
typeChar = "I";
break;
case TypeEnum.CHAR:
typeChar = "C";
break;
case TypeEnum.BOOL:
typeChar = "Z";
break;
case TypeEnum.VOID:
typeChar = "V";
break;
}
return typeChar;
}
}

View File

@@ -1,18 +1,744 @@
package bytecode;
import ast.MethodNode;
import ast.expressions.IExpressionNode;
import ast.expressions.binaryexpressions.*;
import ast.expressions.unaryexpressions.MemberAccessNode;
import ast.expressions.unaryexpressions.NotNode;
import ast.expressions.unaryexpressions.UnaryNode;
import ast.members.ConstructorNode;
import ast.members.MainMethodNode;
import ast.members.MethodNode;
import ast.parameters.ParameterNode;
import ast.statementexpressions.AssignNode;
import ast.statementexpressions.AssignableNode;
import ast.statementexpressions.NewDeclarationNode;
import ast.statementexpressions.crementexpressions.CrementType;
import ast.statementexpressions.crementexpressions.DecrementNode;
import ast.statementexpressions.crementexpressions.IncrementNode;
import ast.statementexpressions.methodcallstatementnexpressions.MethodCallNode;
import ast.statements.*;
import ast.type.AccessModifierNode;
import ast.type.EnumAccessModifierNode;
import ast.type.ValueNode;
import ast.type.type.BaseType;
import ast.type.type.ReferenceType;
import ast.type.type.TypeEnum;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
public class MethodCodeGen {
public void generateMethodCode(ClassWriter classWriter, MethodNode methodNode) {
Mapper mapper = new Mapper();
MethodVisitor constructor =
classWriter.visitMethod(mapper.mapAccesTypeToOpcode(methodNode.visibility),
import java.util.ArrayList;
import java.util.List;
import static org.objectweb.asm.Opcodes.*;
public class MethodCodeGen implements bytecode.visitor.MethodVisitor {
private final ClassWriter classWriter;
private final Mapper mapper;
private MethodVisitor methodVisitor;
private final List<String> localVariables;
public MethodCodeGen(ClassWriter classWriter) {
this.classWriter = classWriter;
mapper = new Mapper();
localVariables = new ArrayList<>();
}
// Method nodes
@Override
public void visit(ConstructorNode constructorNode) {
methodVisitor =
classWriter.visitMethod(mapper.mapAccessTypeToOpcode(constructorNode.accesModifier),
"<init>",
"()V",
mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), constructorNode.parameters),
null,
null);
methodVisitor.visitCode();
localVariables.add("this");
// Add all method parameters to localVariables
for (ParameterNode parameterNode : constructorNode.parameters) {
localVariables.add(parameterNode.identifier);
}
methodVisitor.visitVarInsn(ALOAD, 0);
methodVisitor.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V", false);
// Visit all statements
for (IStatementNode statementNode : constructorNode.block.statements) {
statementNode.accept(this);
}
methodVisitor.visitMaxs(0, 0);
methodVisitor.visitEnd();
}
@Override
public void visit(MainMethodNode mainMethodNode) {
AccessModifierNode accessModifierNode = new AccessModifierNode("");
accessModifierNode.accessType = EnumAccessModifierNode.PUBLIC_STATIC;
methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC,
"main",
"([Ljava/lang/String;)V",
null,
null);
methodVisitor.visitCode();
localVariables.add("this");
localVariables.add("args");
// Visit all statements
for (IStatementNode statementNode : mainMethodNode.block.statements) {
statementNode.accept(this);
}
methodVisitor.visitMaxs(0, 0);
methodVisitor.visitEnd();
}
@Override
public void visit(MethodNode methodNode) {
methodVisitor = classWriter.visitMethod(mapper.mapAccessTypeToOpcode(methodNode.accesModifier),
methodNode.getIdentifier(),
mapper.generateMethodDescriptor(methodNode.getType(), methodNode.parameters),
null,
null);
methodVisitor.visitCode();
localVariables.add("this");
// Add all method parameters to localVariables
for (ParameterNode parameterNode : methodNode.parameters) {
localVariables.add(parameterNode.identifier);
}
// Visit all statements
for (IStatementNode statementNode : methodNode.block.statements) {
statementNode.accept(this);
}
methodVisitor.visitMaxs(0, 0);
methodVisitor.visitEnd();
}
// Binary expressions
@Override
public void visit(BinaryNode binaryNode) {
binaryNode.accept(this);
}
@Override
public void visit(CalculationNode calculationNode) {
if (calculationNode.calculationExpression != null) {
calculationNode.calculationExpression.accept(this);
}
if (calculationNode.dotExpression != null) {
calculationNode.dotExpression.accept(this);
}
if (calculationNode.operator != null) {
switch (calculationNode.operator) {
case PLUS:
methodVisitor.visitInsn(IADD);
break;
case MINUS:
methodVisitor.visitInsn(ISUB);
break;
}
}
}
@Override
public void visit(DotNode dotNode) {
if (dotNode.dotExpression != null) {
dotNode.dotExpression.accept(this);
}
if (dotNode.dotSubtractionExpression != null) {
dotNode.dotSubtractionExpression.accept(this);
}
if (dotNode.operator != null) {
switch (dotNode.operator) {
case DIV:
methodVisitor.visitInsn(IDIV);
break;
case MULT:
methodVisitor.visitInsn(IMUL);
break;
case MOD:
methodVisitor.visitInsn(IREM);
break;
}
}
}
@Override
public void visit(DotSubtractionNode dotSubtractionNode) {
if (dotSubtractionNode.value != null) {
dotSubtractionNode.value.accept(this);
} else if (dotSubtractionNode.identifier != null) {
methodVisitor.visitVarInsn(ILOAD, localVariables.indexOf(dotSubtractionNode.identifier));
} else if (dotSubtractionNode.memberAccess != null) {
dotSubtractionNode.memberAccess.accept(this);
} else if (dotSubtractionNode.methodCall != null) {
dotSubtractionNode.methodCall.accept(this);
} else if (dotSubtractionNode.calculationExpression != null) {
dotSubtractionNode.calculationExpression.accept(this);
}
}
@Override
public void visit(NonCalculationNode nonCalculationNode) {
Label labelFalse = new Label();
Label labelTrue = new Label();
switch (nonCalculationNode.operator) {
case AND:
nonCalculationNode.unaryExpression.accept(this);
methodVisitor.visitJumpInsn(IFEQ, labelFalse); // Value compared to 0 (false)
nonCalculationNode.expression.accept(this);
methodVisitor.visitJumpInsn(IFEQ, labelFalse);
break;
case OR:
nonCalculationNode.unaryExpression.accept(this);
methodVisitor.visitJumpInsn(IFNE, labelTrue);
nonCalculationNode.expression.accept(this);
methodVisitor.visitJumpInsn(IFEQ, labelFalse);
break;
case GREATER:
nonCalculationNode.unaryExpression.accept(this);
nonCalculationNode.expression.accept(this);
methodVisitor.visitJumpInsn(IF_ICMPLE, labelFalse);
break;
case LESS:
nonCalculationNode.unaryExpression.accept(this);
nonCalculationNode.expression.accept(this);
methodVisitor.visitJumpInsn(IF_ICMPGE, labelFalse);
break;
case GREATER_EQUAL:
nonCalculationNode.unaryExpression.accept(this);
nonCalculationNode.expression.accept(this);
methodVisitor.visitJumpInsn(IF_ICMPLT, labelFalse);
break;
case LESS_EQUAL:
nonCalculationNode.unaryExpression.accept(this);
nonCalculationNode.expression.accept(this);
methodVisitor.visitJumpInsn(IF_ICMPGT, labelFalse);
break;
case EQUAL:
nonCalculationNode.unaryExpression.accept(this);
nonCalculationNode.expression.accept(this);
if (nonCalculationNode.unaryExpression.getType() instanceof BaseType && nonCalculationNode.expression.getType() instanceof BaseType) {
methodVisitor.visitJumpInsn(IF_ICMPNE, labelFalse);
} else {
methodVisitor.visitJumpInsn(IF_ACMPNE, labelFalse);
}
break;
case NOT_EQUAL:
nonCalculationNode.unaryExpression.accept(this);
nonCalculationNode.expression.accept(this);
if (nonCalculationNode.unaryExpression.getType() instanceof BaseType && nonCalculationNode.expression.getType() instanceof BaseType) {
methodVisitor.visitJumpInsn(IF_ICMPEQ, labelFalse);
} else {
methodVisitor.visitJumpInsn(IF_ACMPEQ, labelFalse);
}
break;
}
Label labelEndLogicalExpression = new Label();
methodVisitor.visitLabel(labelTrue);
methodVisitor.visitInsn(ICONST_1); // true
methodVisitor.visitJumpInsn(GOTO, labelEndLogicalExpression);
methodVisitor.visitLabel(labelFalse);
methodVisitor.visitInsn(ICONST_0); // false
methodVisitor.visitLabel(labelEndLogicalExpression);
}
// Unary expressions
@Override
public void visit(MemberAccessNode memberAccessNode) {
// Only used to get, not to put
int localVarIndex = localVariables.indexOf("memberAccessNode.identifier"); // TODO
if (localVarIndex >= 0) { // local var object
methodVisitor.visitVarInsn(ALOAD, localVarIndex);
} else { // this field
methodVisitor.visitVarInsn(ALOAD, 0);
}
if (memberAccessNode.getTypeNode() instanceof BaseType) {
methodVisitor.visitFieldInsn(GETFIELD, memberAccessNode.identifiers.get(0), memberAccessNode.identifiers.get(1), mapper.getTypeChar((BaseType) memberAccessNode.getTypeNode()));
} else if (memberAccessNode.getTypeNode() instanceof ReferenceType) {
methodVisitor.visitFieldInsn(GETFIELD, memberAccessNode.identifiers.get(0), memberAccessNode.identifiers.get(1), "L" + ((ReferenceType) memberAccessNode.getTypeNode()).getIdentifier() + ";");
}
}
@Override
public void visit(NotNode notNode) {
Label labelFalse = new Label();
Label labelTrue = new Label();
notNode.expression.accept(this);
methodVisitor.visitJumpInsn(Opcodes.IFNE, labelFalse); // false if value is true (value != 0)
Label labelEndLogicalExpression = new Label();
methodVisitor.visitLabel(labelTrue);
methodVisitor.visitInsn(ICONST_1); // true
methodVisitor.visitJumpInsn(GOTO, labelEndLogicalExpression);
methodVisitor.visitLabel(labelFalse);
methodVisitor.visitInsn(ICONST_0); // false
methodVisitor.visitLabel(labelEndLogicalExpression);
}
@Override
public void visit(UnaryNode unaryNode) {
if (unaryNode.thisExp != null) {
methodVisitor.visitVarInsn(ALOAD, 0); // this
} else if (unaryNode.memberAccess != null) {
unaryNode.memberAccess.setTypeNode(unaryNode.getType());
unaryNode.memberAccess.accept(this);
} else if (unaryNode.value != null) {
unaryNode.value.accept(this);
} else if (unaryNode.notExpression != null) {
unaryNode.notExpression.accept(this);
} else if (unaryNode.statement != null) {
unaryNode.statement.accept(this);
} else if (unaryNode.expression != null) {
unaryNode.expression.accept(this);
} else if (unaryNode.identifier != null) {
methodVisitor.visitVarInsn(ILOAD, localVariables.indexOf(unaryNode.identifier));
}
}
// Statements
@Override
public void visit(BlockNode blockNode) {
for (IStatementNode statementNode : blockNode.statements) {
statementNode.accept(this);
}
}
@Override
public void visit(IfElseNode ifElseNode) {
Label elseLabel = new Label();
Label endLabel = new Label();
Label[] elseIfLabels = new Label[ifElseNode.elseIfStatements.size()];
for (int i = 0; i < ifElseNode.elseIfStatements.size(); i++) {
elseIfLabels[i] = new Label();
}
ifElseNode.ifStatement.expression.accept(this);
if (ifElseNode.elseIfStatements.isEmpty()) {
// No else if
methodVisitor.visitJumpInsn(IFEQ, elseLabel);
} else {
// else if statements
methodVisitor.visitJumpInsn(IFEQ, elseIfLabels[0]);
}
ifElseNode.ifStatement.block.accept(this); // accept if block
methodVisitor.visitJumpInsn(GOTO, endLabel);
for (int i = 0; i < ifElseNode.elseIfStatements.size(); i++) {
methodVisitor.visitLabel(elseIfLabels[i]);
ifElseNode.elseIfStatements.get(i).expression.accept(this);
if (i + 1 < elseIfLabels.length) {
// at least one more else if
methodVisitor.visitJumpInsn(IFEQ, elseIfLabels[i + 1]);
} else {
methodVisitor.visitJumpInsn(IFEQ, elseLabel);
}
ifElseNode.elseIfStatements.get(i).block.accept(this);
methodVisitor.visitJumpInsn(GOTO, endLabel);
}
if (ifElseNode.elseStatement != null) {
methodVisitor.visitLabel(elseLabel);
ifElseNode.elseStatement.block.accept(this);
} else {
methodVisitor.visitLabel(elseLabel);
}
methodVisitor.visitLabel(endLabel);
}
@Override
public void visit(LocalVariableDeclarationNode localVariableDeclarationNode) {
if (localVariableDeclarationNode.expression != null) {
// Process expression
localVariableDeclarationNode.expression.accept(this);
if (localVariableDeclarationNode.expression instanceof UnaryNode) {
UnaryNode unaryNode = (UnaryNode) localVariableDeclarationNode.expression;
if (unaryNode.statement instanceof IncrementNode) {
IncrementNode incrementNode = (IncrementNode) unaryNode.statement;
incrementNode.assignableExpression.typeNode = unaryNode.type;
loadIncrement(incrementNode);
} else if (unaryNode.statement instanceof DecrementNode) {
DecrementNode decrementNode = (DecrementNode) unaryNode.statement;
decrementNode.assignableExpression.typeNode = unaryNode.type;
loadDecrement(decrementNode);
}
}
// add local var to list if not in list
if (!localVariables.contains(localVariableDeclarationNode.identifier)) {
localVariables.add(localVariableDeclarationNode.identifier);
}
if (localVariableDeclarationNode.type instanceof BaseType) {
methodVisitor.visitVarInsn(ISTORE, localVariables.indexOf(localVariableDeclarationNode.identifier));
} else if (localVariableDeclarationNode.type instanceof ReferenceType) {
methodVisitor.visitVarInsn(ASTORE, localVariables.indexOf(localVariableDeclarationNode.identifier));
}
} else {
// Local var declaration
if (!localVariables.contains(localVariableDeclarationNode.identifier)) {
localVariables.add(localVariableDeclarationNode.identifier);
}
}
}
@Override
public void visit(AssignNode assignNode) {
if (assignNode.assignable.memberAccess != null) { // this / object
assignNode.assignable.memberAccess.setTypeNode(assignNode.assignable.typeNode);
if (assignNode.expression instanceof UnaryNode) {
UnaryNode unaryNode = (UnaryNode) assignNode.expression;
if (unaryNode.statement instanceof IncrementNode) {
IncrementNode incrementNode = (IncrementNode) unaryNode.statement;
if (incrementNode.crementType.equals(CrementType.PREFIX)) { // ++i
incrementNode.accept(this); // crement
fieldOrObjectVarCrementAssign(assignNode); // assign
} else { // i++
fieldOrObjectVarCrementAssign(assignNode); // assign
incrementNode.accept(this); // crement
}
} else if (unaryNode.statement instanceof DecrementNode) {
DecrementNode decrementNode = (DecrementNode) unaryNode.statement;
if (decrementNode.crementType.equals(CrementType.PREFIX)) {
decrementNode.accept(this); // crement
fieldOrObjectVarCrementAssign(assignNode); // assign
} else {
fieldOrObjectVarCrementAssign(assignNode); // assign
decrementNode.accept(this); // crement
}
}
} else {
assignFieldOrObjectVar(assignNode);
}
} else { // local var
if (assignNode.expression instanceof UnaryNode) {
UnaryNode unaryNode = (UnaryNode) assignNode.expression;
if (unaryNode.statement instanceof IncrementNode || unaryNode.statement instanceof DecrementNode) {
localVarCrementAssign(assignNode);
}
} else {
assignNode.expression.accept(this);
assignLocalVar(assignNode);
}
}
}
private void loadIncrement(IncrementNode incrementNode) {
AssignableNode assignableNode = incrementNode.assignableExpression;
if (assignableNode.memberAccess != null) {
assignableNode.memberAccess.accept(this);
} else {
if (assignableNode.typeNode instanceof BaseType) {
methodVisitor.visitVarInsn(ILOAD, localVariables.indexOf(assignableNode.identifier));
} else if (assignableNode.typeNode instanceof ReferenceType) {
methodVisitor.visitVarInsn(ALOAD, localVariables.indexOf(assignableNode.identifier));
}
}
}
private void loadDecrement(DecrementNode decrementNode) {
AssignableNode assignableNode = decrementNode.assignableExpression;
if (assignableNode.memberAccess != null) {
assignableNode.memberAccess.accept(this);
} else {
if (assignableNode.typeNode instanceof BaseType) {
methodVisitor.visitVarInsn(ILOAD, localVariables.indexOf(assignableNode.identifier));
} else if (assignableNode.typeNode instanceof ReferenceType) {
methodVisitor.visitVarInsn(ALOAD, localVariables.indexOf(assignableNode.identifier));
}
}
}
private void assignLocalVar(AssignNode assignNode) {
if (!localVariables.contains(assignNode.assignable.identifier)) {
localVariables.add(assignNode.assignable.identifier);
}
if (assignNode.expression.getType() instanceof BaseType) {
methodVisitor.visitVarInsn(ISTORE, localVariables.indexOf(assignNode.assignable.identifier));
} else if (assignNode.expression.getType() instanceof ReferenceType) {
methodVisitor.visitVarInsn(ASTORE, localVariables.indexOf(assignNode.assignable.identifier));
}
}
private void assignFieldOrObjectVar(AssignNode assignNode) {
int localVarIndex = localVariables.indexOf(assignNode.assignable.identifier);
if (localVarIndex >= 0) { // object
methodVisitor.visitVarInsn(ALOAD, localVarIndex);
} else if (assignNode.assignable.memberAccess.thisExpr) { // this
methodVisitor.visitVarInsn(ALOAD, 0);
} else {
localVariables.add(assignNode.assignable.identifier);
}
assignNode.expression.accept(this);
if (assignNode.expression.getType() instanceof BaseType) {
methodVisitor.visitFieldInsn(PUTFIELD, assignNode.assignable.memberAccess.identifiers.get(0), assignNode.assignable.memberAccess.identifiers.get(1), mapper.getTypeChar((BaseType) assignNode.expression.getType()));
} else if (assignNode.expression.getType() instanceof ReferenceType) {
ReferenceType referenceType = (ReferenceType) assignNode.expression.getType();
methodVisitor.visitFieldInsn(PUTFIELD, assignNode.assignable.memberAccess.identifiers.get(0), assignNode.assignable.memberAccess.identifiers.get(1), "L" + referenceType.getIdentifier() + ";");
}
}
private void localVarCrementAssign(AssignNode assignNode) {
UnaryNode unaryNode = (UnaryNode) assignNode.expression;
if (unaryNode.statement instanceof IncrementNode) {
IncrementNode incrementNode = (IncrementNode) unaryNode.statement;
if (incrementNode.crementType.equals(CrementType.PREFIX)) { // ++i
incrementNode.accept(this);
incrementNode.assignableExpression.typeNode = unaryNode.getType();
loadIncrement(incrementNode);
assignLocalVar(assignNode);
} else { // i++
incrementNode.assignableExpression.typeNode = unaryNode.getType();
loadIncrement(incrementNode);
assignLocalVar(assignNode);
incrementNode.accept(this);
}
} else if (unaryNode.statement instanceof DecrementNode) {
DecrementNode decrementNode = (DecrementNode) unaryNode.statement;
if (decrementNode.crementType.equals(CrementType.PREFIX)) {
decrementNode.accept(this);
decrementNode.assignableExpression.typeNode = unaryNode.getType();
loadDecrement(decrementNode);
assignLocalVar(assignNode);
} else {
decrementNode.assignableExpression.typeNode = unaryNode.getType();
loadDecrement(decrementNode);
assignLocalVar(assignNode);
decrementNode.accept(this);
}
}
}
private void fieldOrObjectVarCrementAssign(AssignNode assignNode) {
int localVarIndex = localVariables.indexOf(assignNode.assignable.identifier);
if (localVarIndex >= 0) { // object
methodVisitor.visitVarInsn(ALOAD, localVarIndex);
} else if (assignNode.assignable.memberAccess.thisExpr) { // field
methodVisitor.visitVarInsn(ALOAD, 0);
} else {
localVariables.add(assignNode.assignable.identifier);
}
UnaryNode unaryNode = (UnaryNode) assignNode.expression;
if (unaryNode.statement instanceof IncrementNode) {
IncrementNode incrementNode = (IncrementNode) unaryNode.statement;
incrementNode.assignableExpression.typeNode = unaryNode.getType();
loadIncrement((incrementNode));
} else if (unaryNode.statement instanceof DecrementNode) {
DecrementNode decrementNode = (DecrementNode) unaryNode.statement;
decrementNode.assignableExpression.typeNode = unaryNode.getType();
loadDecrement(decrementNode);
}
if (assignNode.expression.getType() instanceof BaseType) {
methodVisitor.visitFieldInsn(PUTFIELD, assignNode.assignable.memberAccess.identifiers.get(0), assignNode.assignable.memberAccess.identifiers.get(1), mapper.getTypeChar((BaseType) assignNode.expression.getType()));
} else if (assignNode.expression.getType() instanceof ReferenceType) {
ReferenceType referenceType = (ReferenceType) assignNode.expression.getType();
methodVisitor.visitFieldInsn(PUTFIELD, assignNode.assignable.memberAccess.identifiers.get(0), assignNode.assignable.memberAccess.identifiers.get(1), "L" + referenceType.getIdentifier() + ";");
}
}
@Override
public void visit(IncrementNode incrementNode) {
if (incrementNode.assignableExpression.memberAccess != null) { // Object var / field
int localVarIndex = localVariables.indexOf(incrementNode.assignableExpression.identifier);
if (localVarIndex >= 0) { // object
methodVisitor.visitVarInsn(ALOAD, localVarIndex);
} else { // this
methodVisitor.visitVarInsn(ALOAD, 0);
}
if (incrementNode.assignableExpression.memberAccess.getTypeNode() instanceof BaseType) {
methodVisitor.visitFieldInsn(GETFIELD, incrementNode.assignableExpression.memberAccess.identifiers.get(0), incrementNode.assignableExpression.memberAccess.identifiers.get(1), mapper.getTypeChar((BaseType) incrementNode.assignableExpression.memberAccess.getTypeNode()));
} else if (incrementNode.assignableExpression.memberAccess.getTypeNode() instanceof ReferenceType) {
methodVisitor.visitFieldInsn(GETFIELD, incrementNode.assignableExpression.memberAccess.identifiers.get(0), incrementNode.assignableExpression.memberAccess.identifiers.get(1), "L" + (((ReferenceType) incrementNode.assignableExpression.memberAccess.getTypeNode()).getIdentifier() + ";"));
}
methodVisitor.visitInsn(ICONST_1);
methodVisitor.visitInsn(IADD);
if (incrementNode.assignableExpression.memberAccess.getTypeNode() instanceof BaseType) {
methodVisitor.visitFieldInsn(PUTFIELD, incrementNode.assignableExpression.memberAccess.identifiers.get(0), incrementNode.assignableExpression.memberAccess.identifiers.get(1), mapper.getTypeChar((BaseType) incrementNode.assignableExpression.memberAccess.getTypeNode()));
} else if (incrementNode.assignableExpression.memberAccess.getTypeNode() instanceof ReferenceType) {
methodVisitor.visitFieldInsn(PUTFIELD, incrementNode.assignableExpression.memberAccess.identifiers.get(0), incrementNode.assignableExpression.memberAccess.identifiers.get(1), "L" + (((ReferenceType) incrementNode.assignableExpression.memberAccess.getTypeNode()).getIdentifier() + ";"));
}
} else { // local var
methodVisitor.visitIincInsn(localVariables.indexOf(incrementNode.assignableExpression.identifier), 1);
}
}
@Override
public void visit(DecrementNode decrementNode) {
if (decrementNode.assignableExpression.memberAccess != null) { // Object var / field
int localVarIndex = localVariables.indexOf(decrementNode.assignableExpression.identifier);
if (localVarIndex >= 0) { // object
methodVisitor.visitVarInsn(ALOAD, localVarIndex);
} else { // this
methodVisitor.visitVarInsn(ALOAD, 0);
}
if (decrementNode.assignableExpression.memberAccess.getTypeNode() instanceof BaseType) {
methodVisitor.visitFieldInsn(GETFIELD, decrementNode.assignableExpression.memberAccess.identifiers.get(0), decrementNode.assignableExpression.memberAccess.identifiers.get(1), mapper.getTypeChar((BaseType) decrementNode.assignableExpression.memberAccess.getTypeNode()));
} else if (decrementNode.assignableExpression.memberAccess.getTypeNode() instanceof ReferenceType) {
methodVisitor.visitFieldInsn(GETFIELD, decrementNode.assignableExpression.memberAccess.identifiers.get(0), decrementNode.assignableExpression.memberAccess.identifiers.get(1), "L" + (((ReferenceType) decrementNode.assignableExpression.memberAccess.getTypeNode()).getIdentifier() + ";"));
}
methodVisitor.visitInsn(ICONST_1);
methodVisitor.visitInsn(ISUB);
if (decrementNode.assignableExpression.memberAccess.getTypeNode() instanceof BaseType) {
methodVisitor.visitFieldInsn(PUTFIELD, decrementNode.assignableExpression.memberAccess.identifiers.get(0), decrementNode.assignableExpression.memberAccess.identifiers.get(1), mapper.getTypeChar((BaseType) decrementNode.assignableExpression.memberAccess.getTypeNode()));
} else if (decrementNode.assignableExpression.memberAccess.getTypeNode() instanceof ReferenceType) {
methodVisitor.visitFieldInsn(PUTFIELD, decrementNode.assignableExpression.memberAccess.identifiers.get(0), decrementNode.assignableExpression.memberAccess.identifiers.get(1), "L" + (((ReferenceType) decrementNode.assignableExpression.memberAccess.getTypeNode()).getIdentifier() + ";"));
}
} else { // local var
methodVisitor.visitIincInsn(localVariables.indexOf(decrementNode.assignableExpression.identifier), -1);
}
}
@Override
public void visit(NewDeclarationNode newDeclarationNode) {
methodVisitor.visitTypeInsn(NEW, newDeclarationNode.identifier);
methodVisitor.visitInsn(DUP);
List<ParameterNode> parameterNodes = new ArrayList<>();
for (IExpressionNode expressionNode : newDeclarationNode.expressions) {
expressionNode.accept(this);
parameterNodes.add(new ParameterNode(expressionNode.getType(), ""));
}
methodVisitor.visitMethodInsn(INVOKESPECIAL, newDeclarationNode.identifier, "<init>", mapper.generateMethodDescriptor(new BaseType(TypeEnum.VOID), parameterNodes), false);
}
@Override
public void visit(ValueNode valueNode) {
switch (valueNode.valueType) {
case INT_VALUE:
int intValue = Integer.parseInt(valueNode.value);
if (intValue >= Byte.MIN_VALUE && intValue <= Byte.MAX_VALUE) { // load int as byte
methodVisitor.visitIntInsn(BIPUSH, intValue);
} else if (intValue >= Short.MIN_VALUE && intValue <= Short.MAX_VALUE) { // load int as short
methodVisitor.visitIntInsn(SIPUSH, intValue);
} else { // load int as const
methodVisitor.visitLdcInsn(intValue);
}
break;
case BOOLEAN_VALUE:
if (valueNode.value.equals("true")) {
methodVisitor.visitInsn(ICONST_1);
} else {
methodVisitor.visitInsn(ICONST_0);
}
break;
case CHAR_VALUE:
char charValue = valueNode.value.charAt(0);
if (charValue <= Byte.MAX_VALUE) { // load char as byte
methodVisitor.visitIntInsn(BIPUSH, charValue);
} else if (charValue <= Short.MAX_VALUE) { // load char as short
methodVisitor.visitIntInsn(SIPUSH, charValue);
} else { // load char as const
methodVisitor.visitLdcInsn(charValue);
}
break;
case NULL_VALUE:
methodVisitor.visitInsn(ACONST_NULL);
break;
}
}
@Override
public void visit(ReturnNode returnNode) {
if (returnNode.voidReturn) { // Return nothing
methodVisitor.visitInsn(RETURN);
} else { // Return something
// Process expression
returnNode.expression.accept(this);
if (returnNode.expression instanceof UnaryNode) {
UnaryNode unaryNode = (UnaryNode) returnNode.expression;
if (unaryNode.statement instanceof IncrementNode) {
IncrementNode incrementNode = (IncrementNode) unaryNode.statement;
incrementNode.assignableExpression.typeNode = unaryNode.getType();
loadIncrement(incrementNode);
}
if (unaryNode.statement instanceof DecrementNode) {
DecrementNode decrementNode = (DecrementNode) unaryNode.statement;
decrementNode.assignableExpression.typeNode = unaryNode.getType();
loadDecrement(decrementNode);
}
}
// Return result of expression
if (returnNode.expression.getType() instanceof BaseType) {
methodVisitor.visitInsn(IRETURN);
} else if (returnNode.expression.getType() instanceof ReferenceType) {
methodVisitor.visitInsn(ARETURN);
}
}
}
@Override
public void visit(WhileNode whileNode) {
Label loopLabel = new Label();
Label endOfLoopLabel = new Label();
methodVisitor.visitLabel(loopLabel);
// while loop
whileNode.expression.accept(this);
methodVisitor.visitJumpInsn(IFEQ, endOfLoopLabel); // if condition is false, jump out of loop
whileNode.block.accept(this);
methodVisitor.visitJumpInsn(GOTO, loopLabel);
methodVisitor.visitLabel(endOfLoopLabel);
}
@Override
public void visit(MethodCallNode methodCallNode) {
List<ParameterNode> parameterNodes = new ArrayList<>();
int localVarIndex = -1;
if (methodCallNode.target.memberAccess.identifiers.size() > 1) {
localVarIndex = localVariables.indexOf(methodCallNode.target.memberAccess.identifiers.get(1));
}
if (localVarIndex >= 0) { // local var object
methodVisitor.visitVarInsn(ALOAD, localVarIndex);
} else { // this field
methodVisitor.visitVarInsn(ALOAD, 0);
}
for (IExpressionNode expressionNode : methodCallNode.parameters) {
expressionNode.accept(this);
parameterNodes.add(new ParameterNode(expressionNode.getType(), ""));
}
if(methodCallNode.type == null) {
methodCallNode.type = new BaseType(TypeEnum.INT);
}
methodVisitor.visitMethodInsn(INVOKEVIRTUAL, methodCallNode.target.memberAccess.identifiers.get(0), methodCallNode.identifier, mapper.generateMethodDescriptor(methodCallNode.type, parameterNodes), false);
}
}

View File

@@ -0,0 +1,9 @@
package bytecode.visitor;
import ast.ClassNode;
import ast.members.FieldNode;
public interface ClassVisitor {
void visit(ClassNode classNode);
void visit(FieldNode fieldNode);
}

View File

@@ -0,0 +1,68 @@
package bytecode.visitor;
import ast.expressions.binaryexpressions.*;
import ast.expressions.unaryexpressions.MemberAccessNode;
import ast.expressions.unaryexpressions.NotNode;
import ast.expressions.unaryexpressions.UnaryNode;
import ast.members.ConstructorNode;
import ast.members.MainMethodNode;
import ast.members.MethodNode;
import ast.statementexpressions.AssignNode;
import ast.statementexpressions.NewDeclarationNode;
import ast.statementexpressions.crementexpressions.DecrementNode;
import ast.statementexpressions.crementexpressions.IncrementNode;
import ast.statementexpressions.methodcallstatementnexpressions.ChainedMethodNode;
import ast.statementexpressions.methodcallstatementnexpressions.MethodCallNode;
import ast.statements.*;
import ast.type.ValueNode;
public interface MethodVisitor {
// members
void visit(ConstructorNode constructorNode);
void visit(MethodNode methodNode);
void visit(MainMethodNode mainMethodNode);
// Binary expressions
void visit(BinaryNode binaryNode);
void visit(CalculationNode calculationNode);
void visit(DotNode dotNode);
void visit(DotSubtractionNode dotSubtractionNode);
void visit(NonCalculationNode nonCalculationNode);
// Unary expressions
void visit(MemberAccessNode memberAccessNode);
void visit(NotNode notExpressionNode);
void visit(UnaryNode unaryExpressionNode);
// statements
void visit(BlockNode blockNode);
void visit(IfElseNode ifElseNode);
void visit(IncrementNode incrementNode);
void visit(DecrementNode decrementNode);
void visit(LocalVariableDeclarationNode localVariableDeclarationNode);
void visit(ReturnNode returnNode);
void visit(WhileNode whileNode);
// statement expression
void visit(MethodCallNode methodCallNode);
void visit(AssignNode assignNode);
void visit(NewDeclarationNode newDeclarationNode);
// type
void visit(ValueNode valueNode);
}

View File

@@ -0,0 +1,7 @@
package bytecode.visitor;
import ast.ProgramNode;
public interface ProgramVisitor {
void visit(ProgramNode programNode);
}

View File

@@ -0,0 +1,116 @@
package main;
import ast.ASTNode;
import ast.ProgramNode;
import parser.astBuilder.ASTBuilder;
import parser.generated.SimpleJavaLexer;
import parser.generated.SimpleJavaParser;
import semantic.SemanticAnalyzer;
import bytecode.ByteCodeGenerator;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.tree.ParseTree;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.Optional;
/**
* Start miniCompiler using make:
* <p> <code> cd .\src\test\ </code>
* <p> <code> make clean compile-miniCompiler </code>
* <p> Start miniCompiler using jar:
* <p> <code> java.exe -DgenJar=true_OR_false -DgenClass=true_OR_false -jar path_to_jar\JavaCompiler-1.0-jar-with-dependencies.jar 'path_to_input_file.java' 'path_to_output_directory' </code>
* <p> Example (jar needs to be in the target directory, compile with make or mvn package first):
* <code> java.exe -DgenJar=true -DgenClass=true -jar .\target\JavaCompiler-1.0-jar-with-dependencies.jar 'src/main/resources/input/CompilerInput.java' 'src/main/resources/output' </code>
*/
public class Main {
public static void main(String[] args) throws Exception {
if (args.length == 2) {
// args[0] is the input file path
// args[1] is the output directory path
String inputFilePath = args[0];
String outputDirectoryPath = args[1];
System.out.println("Compiling file: " + inputFilePath);
try {
CharStream inputCharStream = CharStreams.fromPath(Paths.get(inputFilePath));
compileFile(inputCharStream, outputDirectoryPath);
} catch (IOException e) {
System.err.println("Error reading the file: " + e.getMessage());
}
}
else {
try {
CharStream codeCharStream = CharStreams.fromPath(Paths.get("src/test/resources/input/finalTest/Car.java"));
compileFile(codeCharStream, "src/test/resources/input/finalTest");
} catch (IOException e) {
System.err.println("Error reading the file: " + e.getMessage());
}
}
}
/**
* This method is used to compile a file from a given CharStream and output the bytecode to a specified directory.
* It goes through the following steps:
* <p>1. Scanner: It uses the SimpleJavaLexer to tokenize the input CharStream.
* <p>2. Parser: It uses the SimpleJavaParser to parse the tokens and generate a ParseTree.
* <p>3. AST Builder: It uses the ASTBuilder to visit the ParseTree and generate an Abstract Syntax Tree (AST).
* <p>4. Semantic Analyzer: It uses the SemanticAnalyzer to generate a typed AST.
* <p>5. Bytecode Generator: It uses the ByteCodeGenerator to generate bytecode from the typed AST and output it to the specified directory.
*
* @param inputCharStream The CharStream representing the input file to be compiled.
* @param outputDirectoryPath The path of the directory where the output bytecode should be written.
*/
static void compileFile(CharStream inputCharStream, String outputDirectoryPath) {
// Initialize the logger
new MiniCompilerLogger();
/* ------------------------- Scanner -> tokens ------------------------- */
// Use the SimpleJavaLexer to tokenize the input CharStream
SimpleJavaLexer lexer = new SimpleJavaLexer(inputCharStream);
CommonTokenStream tokenStream = new CommonTokenStream(lexer);
tokenStream.fill();
// Log the tokens
MiniCompilerLogger.logScanner(tokenStream);
/*------------------------- Parser -> Parsetree -------------------------*/
// Use the SimpleJavaParser to parse the tokens and generate a ParseTree
SimpleJavaParser parser = new SimpleJavaParser(tokenStream);
ParseTree parseTree = parser.program(); // parse the input
// Log the ParseTree
MiniCompilerLogger.logParser(parseTree, parser);
/*------------------------- AST builder -> AST -------------------------*/
// Use the ASTBuilder to visit the ParseTree and generate an Abstract Syntax Tree (AST)
ASTBuilder astBuilder = new ASTBuilder();
ASTNode abstractSyntaxTree = astBuilder.visit(parseTree);
// Log the AST
MiniCompilerLogger.logAST(abstractSyntaxTree);
/*------------------------- Semantic Analyzer -> typed AST -------------------------*/
// Use the SemanticAnalyzer to generate a typed AST
ASTNode typedAst = SemanticAnalyzer.generateTast(abstractSyntaxTree);
// Log the typed AST
MiniCompilerLogger.logSemanticAnalyzer(typedAst);
if(SemanticAnalyzer.errors.isEmpty()){
/*------------------------- Bytecode Generator -> Bytecode -------------------------*/
// Use the ByteCodeGenerator to generate bytecode from the typed AST and output it to the specified directory
final boolean genJar = Optional.ofNullable(System.getProperty("genJar")).map(String::toLowerCase).map(Boolean::parseBoolean).orElse(true);
final boolean genClass = Optional.ofNullable(System.getProperty("genClass")).map(String::toLowerCase).map(Boolean::parseBoolean).orElse(true);
ByteCodeGenerator byteCodeGenerator = new ByteCodeGenerator(outputDirectoryPath, genJar, genClass);
assert typedAst != null;
byteCodeGenerator.visit((ProgramNode) typedAst);
// Log the bytecode generation
MiniCompilerLogger.logBytecodeGenerator();
} else {
for(Exception exception : SemanticAnalyzer.errors){
exception.printStackTrace();
}
}
}
}

View File

@@ -0,0 +1,186 @@
package main;
import ast.ASTNode;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.Parser;
import org.antlr.v4.runtime.RuleContext;
import org.antlr.v4.runtime.Token;
import org.antlr.v4.runtime.tree.ParseTree;
import parser.generated.SimpleJavaLexer;
import parser.generated.SimpleJavaParser;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.logging.*;
/**
* Beispiel für Logging-Arten:
* <p><code>logger.severe("Schwerwiegender Fehler");</code>
* <p><code>logger.warning("Warnung");</code>
* <p><code>logger.info("Information");</code>
* <p><code>logger.config("Konfigurationshinweis");</code>
* <p><code>logger.fine("Fein");</code>
* <p><code>logger.finer("Feiner");</code>
* <p><code>logger.finest("Am feinsten");</code>
* <p>You may toggle the logging level of the console and file handlers by
* changing the level ALL/OFF/etc. in the constructor.
* <code>consoleHandler.setLevel(Level.OFF);</code>
* <code>fileHandler.setLevel(Level.ALL);</code>
*/
public class MiniCompilerLogger {
static Logger logger = Logger.getLogger("miniCompilerLogs");
public MiniCompilerLogger() {
// ------------------------- Logging -------------------------
logger.setLevel(Level.ALL);
logger.getParent().getHandlers()[0].setLevel(Level.ALL);
logger.setUseParentHandlers(false);
// Custom formatter class
class CustomFormatter extends Formatter {
private final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss dd-MM-yyyy");
@Override
public String format(LogRecord record) {
return formatMessage(record) + System.lineSeparator();
}
@Override
public String getHead(Handler h) {
Date now = new Date();
String dateTime = dateFormat.format(now);
return "Log Start Time: " + dateTime + "\n"
+ "Logger Name: " + h.getFormatter().getClass().getName() + "\n\n";
}
}
try {
// Configure console handler
Handler consoleHandler = new ConsoleHandler();
// Toggle console logging on/off
consoleHandler.setLevel(Level.OFF);
consoleHandler.setFormatter(new CustomFormatter());
logger.addHandler(consoleHandler);
// Configure file handler
Handler fileHandler = new FileHandler("src/main/resources/logs/miniCompiler.log");
// Toggle file logging on/off
fileHandler.setLevel(Level.ALL);
fileHandler.setFormatter(new CustomFormatter());
logger.addHandler(fileHandler);
} catch (SecurityException e) {
e.printStackTrace();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public static void logScanner(CommonTokenStream tokenStream) {
// Printing the tokens
logger.info("-------------------- Scanner -> Tokens --------------------");
List<Token> tokens = tokenStream.getTokens();
for (Token token : tokens) {
String tokenType =
SimpleJavaLexer.VOCABULARY.getSymbolicName(token.getType());
String tokenText = token.getText();
// logger.info("Token Type: " + tokenType + ", Token Text: " + tokenText);
logger.info(tokenType + " " + tokenText);
}
logger.info("\n");
}
public static void logParser(ParseTree parseTree, SimpleJavaParser parser) {
// Printing the parse tree
logger.info("-------------------- Parser -> Parsetree --------------------");
logger.info(parseTree.toStringTree(parser)); //one line representation
logTree(parseTree, parser, 0);
logger.info("\n");
}
public static void logAST(ASTNode abstractSyntaxTree) {
// Printing the AST
logger.info("-------------------- AST builder -> AST --------------------");
logger.info("Abstract Syntax Tree generated, Startnode:");
logAST(abstractSyntaxTree, 0);
logger.info("\n");
}
public static void logSemanticAnalyzer(ASTNode typedAst) {
// Printing the typed AST
logger.info("-------------------- Semantic Analyzer -> typed AST --------------------");
// logAST(typedAst, 0);
logger.info("Typed Abstract Syntax Tree generated without errors");
logger.info("\n");
}
public static void logBytecodeGenerator() {
// Printing the bytecode
logger.info("-------------------- Bytecode Generator -> Bytecode --------------------");
logger.info("Bytecode generated without errors");
logger.info("\n");
}
/* ------------------------- Printing methods ------------------------- */
/**
* This method is used to print the parse tree in a structured format.
* It recursively traverses the tree and prints the rule names and text of the
* nodes.
*
* @param tree The parse tree to be printed.
* @param parser The parser used to parse the input. It's used to get the rule
* names.
* @param indent The current indentation level. It's used to format the output.
*/
public static void logTree(ParseTree tree, Parser parser, int indent) {
// Create an indentation string based on the current indentation level
String indentString = " ".repeat(indent * 2);
// If the tree node is an instance of RuleContext (i.e., it's an internal node),
// print the rule name
if (tree instanceof RuleContext) {
int ruleIndex = ((RuleContext) tree).getRuleIndex();
String ruleName = parser.getRuleNames()[ruleIndex];
logger.info(indentString + ruleName);
} else {
// If the tree node is not an instance of RuleContext (i.e., it's a leaf node),
// print the text of the node
logger.info(indentString + tree.getText());
}
// Recursively print the children of the current node, increasing the
// indentation level
for (int i = 0; i < tree.getChildCount(); i++) {
logTree(tree.getChild(i), parser, indent + 1);
}
}
public static void logAST(ASTNode abstractSyntaxTree, int indent) {
if (abstractSyntaxTree == null) {
logger.severe("AST is null !!!");
return;
}
String indentString = " ".repeat(indent * 2);
logger.info(indentString + abstractSyntaxTree.getClass());
// for (ASTNode child : abstractSyntaxTree.getChildren()) {
// logAST(child, indent + 1);
// }
}
}

View File

@@ -1,109 +0,0 @@
package parser;
import ast.*;
import parser.generated.SimpleJavaBaseVisitor;
import parser.generated.SimpleJavaParser;
import java.util.ArrayList;
import java.util.List;
public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
@Override
public ASTNode visitProgram(SimpleJavaParser.ProgramContext ctx) {
ProgramNode program = new ProgramNode();
for (SimpleJavaParser.ClassDeclarationContext classDeclCtx : ctx.classDeclaration()) {
program.addClass((ClassNode) visit(classDeclCtx));
}
return program;
}
@Override
public ASTNode visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) {
ClassNode classNode = new ClassNode((AccessTypeNode) visit(ctx.accessType()),ctx.IDENTIFIER().getText());
for (SimpleJavaParser.MemberDeclarationContext member : ctx.memberDeclaration()) {
classNode.addMember((MemberNode) visit(member));
}
classNode.ensureConstructor();
return classNode;
}
@Override
public ASTNode visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) {
AccessTypeNode accessType = (AccessTypeNode) visit(ctx.accessType());
TypeNode type = (TypeNode) visit(ctx.type());
String identifier = ctx.IDENTIFIER().getText();
return new FieldNode(accessType, type, identifier);
}
@Override
public ASTNode visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx) {
AccessTypeNode accessType = (AccessTypeNode) visit(ctx.accessType());
TypeNode returnType = (TypeNode) visit(ctx.type());
String methodName = ctx.IDENTIFIER().getText();
ParameterListNode parameterListNode = (ParameterListNode) visit(ctx.parameterList());
List<StatementNode> statements = new ArrayList<>();
for (SimpleJavaParser.StatementContext stmtCtx : ctx.statement()) {
statements.add((StatementNode) visit(stmtCtx));
}
MethodNode method = new MethodNode(accessType,returnType, methodName, parameterListNode, statements);
return method;
}
@Override
public ASTNode visitParameterList(SimpleJavaParser.ParameterListContext ctx) {
List<ParameterNode> parameters = new ArrayList<>();
for (SimpleJavaParser.ParameterContext paramCtx : ctx.parameter()) {
parameters.add((ParameterNode) visitParameter(paramCtx));
}
return new ParameterListNode(parameters);
}
@Override
public ASTNode visitParameter(SimpleJavaParser.ParameterContext ctx) {
TypeNode type = (TypeNode) visit(ctx.type());
String identifier = ctx.IDENTIFIER().getText();
return new ParameterNode(type, identifier);
}
@Override
public ASTNode visitType(SimpleJavaParser.TypeContext ctx) {
String typeStr = ctx.getText();
switch (typeStr) {
case "int":
return new TypeNode(EnumTypeNode.INT);
case "boolean":
return new TypeNode(EnumTypeNode.BOOLEAN);
case "char":
return new TypeNode(EnumTypeNode.CHAR);
default:
throw new IllegalArgumentException("Unsupported type: " + typeStr);
}
}
@Override
public ASTNode visitAccessType(SimpleJavaParser.AccessTypeContext ctx) {
String typeStr = ctx.getText();
switch (typeStr) {
case "public":
return new AccessTypeNode(EnumAccessTypeNode.PUBLIC);
case "private":
return new AccessTypeNode(EnumAccessTypeNode.PRIVATE);
default:
throw new IllegalArgumentException("Unsupported type: " + typeStr);
}
}
@Override
public ASTNode visitStatement(SimpleJavaParser.StatementContext ctx) {
if (ctx.variableDeclarationStatement() != null) {
return visitVariableDeclarationStatement(ctx.variableDeclarationStatement());
} else if (ctx.assignmentStatement() != null) {
return visitAssignmentStatement(ctx.assignmentStatement());
}
return null;
}
}

View File

@@ -1,58 +0,0 @@
grammar SimpleJava;
program : classDeclaration+;
classDeclaration : accessType 'class' IDENTIFIER '{' memberDeclaration* '}';
memberDeclaration : fieldDeclaration | methodDeclaration;
fieldDeclaration : accessType type IDENTIFIER ';';
methodDeclaration : accessType 'static' type IDENTIFIER '(' parameterList? ')' '{' statement* '}' ;
parameterList : parameter (',' parameter)* ;
parameter : type IDENTIFIER ;
type : 'int' | 'boolean' | 'char' ;
accessType : 'public' | 'private' ;
statement
: variableDeclarationStatement
| assignmentStatement
| ifStatement
| whileStatement
| returnStatement
| block
;
variableDeclarationStatement : type IDENTIFIER ('=' expression)? ';' ;
assignmentStatement : IDENTIFIER '=' expression ';' ;
ifStatement : 'if' '(' expression ')' statement ('else' statement)? ;
whileStatement : 'while' '(' expression ')' statement ;
returnStatement : 'return' (expression)? ';' ;
block : '{' statement* '}' ;
expression
: expression ('&&' | '||') expression
| expression ('==' | '!=' | '<' | '<=' | '>' | '>=') expression
| expression ('+' | '-' | '*' | '/' | '%') expression
| '-' expression
| '!' expression
| '(' expression ')'
| literal
| IDENTIFIER
;
literal : INTEGERLITERAL | booleanLiteral | charLiteral ;
INTEGERLITERAL : [0-9]+ ;
booleanLiteral : 'true' | 'false' ;
charLiteral : '\'' . '\'' ;
IDENTIFIER : [a-zA-Z][a-zA-Z0-9_]* ;
WS : [ \t\r\n]+ -> skip;

View File

@@ -0,0 +1,903 @@
package parser.astBuilder;
import ast.*;
import ast.expressions.IExpressionNode;
import ast.expressions.binaryexpressions.*;
import ast.expressions.unaryexpressions.MemberAccessNode;
import ast.expressions.unaryexpressions.NotNode;
import ast.expressions.unaryexpressions.UnaryNode;
import ast.members.*;
import ast.parameters.ParameterNode;
import ast.statementexpressions.AssignNode;
import ast.statementexpressions.AssignableNode;
import ast.statementexpressions.IStatementExpressionNode;
import ast.statementexpressions.NewDeclarationNode;
import ast.statementexpressions.crementexpressions.CrementType;
import ast.statementexpressions.crementexpressions.DecrementNode;
import ast.statementexpressions.crementexpressions.IncrementNode;
import ast.statementexpressions.methodcallstatementnexpressions.ChainedMethodNode;
import ast.statementexpressions.methodcallstatementnexpressions.MethodCallNode;
import ast.statementexpressions.methodcallstatementnexpressions.TargetNode;
import ast.statements.*;
import ast.type.AccessModifierNode;
import ast.type.type.*;
import ast.type.EnumValueNode;
import ast.type.ValueNode;
import org.antlr.v4.runtime.tree.TerminalNode;
import parser.generated.*;
import java.util.ArrayList;
import java.util.List;
/**
* ASTBuilder is a visitor that converts the parse tree into an abstract syntax tree (AST).
*/
public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
/**
* Visits a program node and creates a ProgramNode.
* It iterates through all class declarations in the context and adds them to the ProgramNode.
*
* @param ctx the program context
* @return the AST node for the program
*/
@Override
public ASTNode visitProgram(SimpleJavaParser.ProgramContext ctx) {
ProgramNode program = new ProgramNode();
for (SimpleJavaParser.ClassDeclarationContext classDeclCtx : ctx.classDeclaration()) {
program.addClass((ClassNode) visit(classDeclCtx));
}
return program;
}
/**
* Visits a class declaration and creates a ClassNode.
* It checks for an access modifier, processes member declarations, and ensures the class has a constructor.
*
* @param ctx the class declaration context
* @return the AST node for the class
*/
@Override
public ASTNode visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) {
ClassNode classNode;
if(ctx.AccessModifier() != null){
classNode = new ClassNode(ctx.AccessModifier().getText(), ctx.Identifier().getText());
}
else{
classNode = new ClassNode("public", ctx.Identifier().getText());
}
boolean hasConstructor = false;
for (SimpleJavaParser.MemberDeclarationContext member : ctx.memberDeclaration()) {
MemberNode memberNode = (MemberNode) visit(member);
if(memberNode != null) {
if(memberNode instanceof ConstructorNode){
hasConstructor = true;
}
classNode.addMember(memberNode);
}
}
if(!hasConstructor){
BlockNode blockNode = new BlockNode();
blockNode.addStatement(new ReturnNode(null));
classNode.members.addFirst(new ConstructorNode("public", ctx.Identifier().getText(), blockNode));
}
return classNode;
}
/**
* Visits a constructor declaration and creates a ConstructorNode.
* It processes access modifiers, block statements, and parameters.
*
* @param ctx the constructor declaration context
* @return the AST node for the constructor
*/
@Override
public ASTNode visitConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx) {
ConstructorNode constructorNode;
if(ctx.AccessModifier() != null) {
constructorNode = new ConstructorNode(ctx.AccessModifier().getText(), ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
} else {
constructorNode = new ConstructorNode("public", ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
}
if(ctx.parameterList() != null) {
for(SimpleJavaParser.ParameterContext parameter : ctx.parameterList().parameter()) {
constructorNode.addParameter((ParameterNode) visit(parameter));
}
}
constructorNode.block.addStatement(new ReturnNode(null));
return constructorNode;
}
/**
* Visits a method declaration and creates a MethodNode or MainMethodNode.
* It handles method types, access modifiers, block statements, and parameters.
*
* @param ctx the method declaration context
* @return the AST node for the method
*/
@Override
public ASTNode visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx) {
if(ctx.MainMethodDeclaration() != null) {
MainMethodNode mainMethod = new MainMethodNode((BlockNode) visit(ctx.blockStatement()));
mainMethod.block.addStatement(new ReturnNode(null));
return mainMethod;
} else {
if(ctx.type() != null) {
if(ctx.AccessModifier() != null) {
MethodNode methodNode = new MethodNode(ctx.AccessModifier().getText(), createTypeNode(ctx.type().getText()), false, ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
if(ctx.parameterList() != null) {
for(SimpleJavaParser.ParameterContext parameter : ctx.parameterList().parameter()) {
methodNode.addParameter((ParameterNode) visit(parameter));
}
}
return methodNode;
} else {
MethodNode methodNode = new MethodNode("public", createTypeNode(ctx.type().getText()), false, ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
if(ctx.parameterList() != null) {
for(SimpleJavaParser.ParameterContext parameter : ctx.parameterList().parameter()) {
methodNode.addParameter((ParameterNode) visit(parameter));
}
}
return methodNode;
}
} else {
if(ctx.AccessModifier() != null) {
MethodNode methodNode = new MethodNode(ctx.AccessModifier().getText(), null, true, ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
if(ctx.parameterList() != null) {
for(SimpleJavaParser.ParameterContext parameter : ctx.parameterList().parameter()) {
methodNode.addParameter((ParameterNode) visit(parameter));
}
}
methodNode.block.addStatement(new ReturnNode(null));
return methodNode;
} else {
MethodNode methodNode = new MethodNode("public", null, true, ctx.Identifier().getText(), (BlockNode) visit(ctx.blockStatement()));
if(ctx.parameterList() != null) {
for(SimpleJavaParser.ParameterContext parameter : ctx.parameterList().parameter()) {
methodNode.addParameter((ParameterNode) visit(parameter));
}
}
methodNode.block.addStatement(new ReturnNode(null));
return methodNode;
}
}
}
}
/**
* Visits a field declaration and creates a FieldNode.
* It handles access modifiers and types.
*
* @param ctx the field declaration context
* @return the AST node for the field
*/
@Override
public ASTNode visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) {
if(ctx.AccessModifier() != null) {
return new FieldNode(new AccessModifierNode(ctx.AccessModifier().getText()), createTypeNode(ctx.type().getText()), ctx.Identifier().getText());
} else {
return new FieldNode(new AccessModifierNode("public"), createTypeNode(ctx.type().getText()), ctx.Identifier().getText());
}
}
/**
* Visits a parameter and creates a ParameterNode.
* It handles the type and identifier of the parameter.
*
* @param ctx the parameter context
* @return the AST node for the parameter
*/
@Override
public ASTNode visitParameter(SimpleJavaParser.ParameterContext ctx) {
return new ParameterNode(createTypeNode(ctx.type().getText()), ctx.Identifier().getText());
}
/**
* Visits a statement and creates the corresponding AST node.
* It determines the specific type of statement and processes it accordingly.
*
* @param ctx the statement context
* @return the AST node for the statement
*/
@Override
public ASTNode visitStatement(SimpleJavaParser.StatementContext ctx) {
if(ctx.returnStatement() != null) {
return visitReturnStatement(ctx.returnStatement());
} else if(ctx.localVariableDeclaration() != null) {
return visitLocalVariableDeclaration(ctx.localVariableDeclaration());
} else if(ctx.blockStatement() != null) {
return visitBlockStatement(ctx.blockStatement());
} else if(ctx.whileStatement() != null) {
return visitWhileStatement(ctx.whileStatement());
} else if(ctx.doWhileStatement() != null) {
return visitDoWhileStatement(ctx.doWhileStatement());
} else if(ctx.forStatement() != null) {
return visitForStatement(ctx.forStatement());
} else if(ctx.ifElseStatement() != null) {
return visitIfElseStatement(ctx.ifElseStatement());
} else if(ctx.switchStatement() != null) {
return visitSwitchStatement(ctx.switchStatement());
} else if(ctx.statementExpression() != null) {
return visitStatementExpression(ctx.statementExpression());
}
return null;
}
/**
* Visits a return statement and creates a ReturnNode.
* It processes the expression in the return statement.
*
* @param ctx the return statement context
* @return the AST node for the return statement
*/
@Override
public ASTNode visitReturnStatement(SimpleJavaParser.ReturnStatementContext ctx) {
return new ReturnNode((IExpressionNode) visit(ctx.expression()));
}
/**
* Visits a return statement and creates a ReturnNode.
* It processes the expression in the return statement.
*
* @param ctx the return statement context
* @return the AST node for the return statement
*/
@Override
public ASTNode visitLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx) {
if(ctx.Assign() != null) {
return new LocalVariableDeclarationNode(createTypeNode(ctx.type().getText()), ctx.Identifier().getText(), ctx.Assign().getText(), (IExpressionNode) visit(ctx.expression()));
} else {
return new LocalVariableDeclarationNode(createTypeNode(ctx.type().getText()), ctx.Identifier().getText(), null, null);
}
}
/**
* Visits a block statement and creates a BlockNode.
* It processes all statements within the block.
*
* @param ctx the block statement context
* @return the AST node for the block statement
*/
@Override
public ASTNode visitBlockStatement(SimpleJavaParser.BlockStatementContext ctx) {
BlockNode blockNode = new BlockNode();
for(SimpleJavaParser.StatementContext statement : ctx.statement()) {
blockNode.addStatement((IStatementNode) visit(statement));
}
return blockNode;
}
/**
* Visits a while statement and creates a WhileNode.
* It processes the condition expression and the block statement.
*
* @param ctx the while statement context
* @return the AST node for the while statement
*/
@Override
public ASTNode visitWhileStatement(SimpleJavaParser.WhileStatementContext ctx) {
return new WhileNode((IExpressionNode) visit(ctx.expression()), (BlockNode) visit(ctx.blockStatement()));
}
/**
* Visits a do-while statement and creates a BlockNode containing a WhileNode.
* It processes the condition expression and the block statement.
*
* @param ctx the do-while statement context
* @return the AST node for the do-while statement
*/
@Override
public ASTNode visitDoWhileStatement(SimpleJavaParser.DoWhileStatementContext ctx) {
IExpressionNode condition = (IExpressionNode) visit(ctx.expression());
BlockNode doBlock = (BlockNode) visit(ctx.blockStatement());
WhileNode While = new WhileNode(condition, doBlock);
BlockNode resultBlock = new BlockNode();
resultBlock.addStatement(doBlock);
resultBlock.addStatement(While);
return resultBlock;
}
/**
* Visits a for statement and creates a BlockNode that contains a WhileNode.
* It processes the initialization, condition, and increment parts of the for loop.
*
* @param ctx the for statement context
* @return the AST node for the for statement
*/
@Override
public ASTNode visitForStatement(SimpleJavaParser.ForStatementContext ctx) {
List<IStatementNode> statements = new ArrayList<>();
// Initialisierung
int i = 0;
if (ctx.localVariableDeclaration() != null) {
statements.add((IStatementNode) visit(ctx.localVariableDeclaration()));
} else if (ctx.statementExpression(i) != null) {
statements.add((IStatementNode) visit(ctx.statementExpression(i)));
i++;
}
// Bedingung
IExpressionNode condition = (IExpressionNode) visit(ctx.expression());
// Inkrement
IStatementExpressionNode crement = null;
if (ctx.statementExpression(i) != null) {
crement = (IStatementExpressionNode) visit(ctx.statementExpression(i));
}
BlockNode forBlock = (BlockNode) visit(ctx.blockStatement());
// While-Schleife
BlockNode whileBody = new BlockNode();
// Block Statements der For-Schleife in den While-Block kopieren
for (IStatementNode statement : forBlock.statements) {
whileBody.addStatement(statement);
}
// Post-Inkrement: Das Inkrement kommt nach dem Block
if (crement != null) {
whileBody.addStatement(crement);
}
// Bedingung der While-Schleife
WhileNode whileNode = new WhileNode(condition, whileBody);
statements.add(whileNode);
BlockNode resultBlock = new BlockNode();
for (IStatementNode statement : statements) {
resultBlock.addStatement(statement);
}
return resultBlock;
}
/**
* Visits an if-else statement and creates an IfElseNode.
* It processes the if, else-if, and else parts of the statement.
*
* @param ctx the if-else statement context
* @return the AST node for the if-else statement
*/
@Override
public ASTNode visitIfElseStatement(SimpleJavaParser.IfElseStatementContext ctx) {
IfElseNode ifElseStatementNode;
if(ctx.elseStatement() != null) {
ifElseStatementNode = new IfElseNode((IfNode) visit(ctx.ifStatement()),
(ElseNode) visit(ctx.elseStatement()));
} else {
ifElseStatementNode = new IfElseNode((IfNode) visit(ctx.ifStatement()), null);
}
for (SimpleJavaParser.ElseIfStatementContext elseIf : ctx.elseIfStatement()){
ifElseStatementNode.addElseIfStatement(((IfNode) visit(elseIf)));
}
return ifElseStatementNode;
}
/**
* Visits an if statement and creates an IfNode.
* It processes the condition expression and the block statement.
*
* @param ctx the if statement context
* @return the AST node for the if statement
*/
@Override
public ASTNode visitIfStatement(SimpleJavaParser.IfStatementContext ctx) {
return new IfNode((IExpressionNode) visit(ctx.expression()), (BlockNode) visit(ctx.blockStatement()));
}
/**
* Visits an else-if statement and creates an IfNode.
* It processes the condition expression and the block statement.
*
* @param ctx the else-if statement context
* @return the AST node for the else-if statement
*/
@Override
public ASTNode visitElseIfStatement(SimpleJavaParser.ElseIfStatementContext ctx) {
return new IfNode((IExpressionNode) visit(ctx.expression()), (BlockNode) visit(ctx.blockStatement()));
}
/**
* Visits an else statement and creates an ElseNode.
* It processes the block statement of the else part.
*
* @param ctx the else statement context
* @return the AST node for the else statement
*/
@Override
public ASTNode visitElseStatement(SimpleJavaParser.ElseStatementContext ctx) {
return new ElseNode((BlockNode) visit(ctx.blockStatement()));
}
/**
* Visits a statement expression and creates the corresponding AST node.
* It handles assignments, new declarations, method calls, and increment/decrement expressions.
*
* @param ctx the statement expression context
* @return the AST node for the statement expression
*/
@Override
public ASTNode visitStatementExpression(SimpleJavaParser.StatementExpressionContext ctx) {
if(ctx.assign() != null) {
return visitAssign(ctx.assign());
} else if(ctx.newDeclaration() != null) {
return visitNewDeclaration(ctx.newDeclaration());
} else if(ctx.methodCall() != null) {
return visitMethodCall(ctx.methodCall());
} else if(ctx.crementExpression() != null) {
return visitCrementExpression(ctx.crementExpression());
}
return null;
}
/**
* Visits a switch statement and creates an IfElseNode representing the switch cases.
* It processes the switch expression, case statements, and default statement.
*
* @param ctx the switch statement context
* @return the AST node for the switch statement
*/
@Override
public ASTNode visitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx) {
UnaryNode switchExpression = (UnaryNode) visit(ctx.expression());
List<IfNode> ifNodes = new ArrayList<>();
for (SimpleJavaParser.CaseStatementContext caseCtx : ctx.caseStatement()) {
IExpressionNode caseExpression = (IExpressionNode) visit(caseCtx.value());
// Condition as NonCalculationNode -> Equals Expression
NonCalculationNode condition = new NonCalculationNode(switchExpression, "==", caseExpression);
BlockNode caseBlock = new BlockNode();
for (SimpleJavaParser.StatementContext stmtCtx : caseCtx.statement()) {
caseBlock.addStatement((IStatementNode) visit(stmtCtx));
}
// Each case as if
IfNode ifNode = new IfNode(condition, caseBlock);
ifNodes.add(ifNode);
}
// Check if has Default
ElseNode defaulElseNode = null;
if (ctx.defaultStatement() != null) {
BlockNode defaultBlock = new BlockNode();
for (SimpleJavaParser.StatementContext stmtCtx : ctx.defaultStatement().statement()) {
defaultBlock.addStatement((IStatementNode) visit(stmtCtx));
}
// Default als letztes Else Statement
defaulElseNode = new ElseNode(defaultBlock);
}
IfElseNode ifElseNode = new IfElseNode(ifNodes.getFirst(),defaulElseNode);
ifNodes.removeFirst();
for (IfNode ifNode : ifNodes){
ifElseNode.addElseIfStatement(ifNode);
}
return ifElseNode;
}
/**
* Visits an assignment expression and creates an AssignNode.
* It handles the assignable expression and the assigned expression.
*
* @param ctx the assignment context
* @return the AST node for the assignment
*/
@Override
public ASTNode visitAssign(SimpleJavaParser.AssignContext ctx) {
return new AssignNode((AssignableNode) visit(ctx.assignableExpression()), (IExpressionNode) visit(ctx.expression()));
}
/**
* Visits a new declaration and creates a NewDeclarationNode.
* It processes the identifier and the argument list.
*
* @param ctx the new declaration context
* @return the AST node for the new declaration
*/
@Override
public ASTNode visitNewDeclaration(SimpleJavaParser.NewDeclarationContext ctx) {
NewDeclarationNode newDeclarationNode = new NewDeclarationNode(ctx.Identifier().getText());
for(SimpleJavaParser.ExpressionContext expression : ctx.argumentList().expression()) {
newDeclarationNode.addExpression((IExpressionNode) visit(expression));
}
return newDeclarationNode;
}
/**
* Visits a method call and creates a MethodCallNode.
* It processes the target, chained methods, and argument list.
*
* @param ctx the method call context
* @return the AST node for the method call
*/
@Override
public ASTNode visitMethodCall(SimpleJavaParser.MethodCallContext ctx) {
MethodCallNode methodCallStatementExpressionNode;
if(ctx.target() != null) {
methodCallStatementExpressionNode = new MethodCallNode((TargetNode) visit(ctx.target()), ctx.Identifier().getText());
} else {
methodCallStatementExpressionNode = new MethodCallNode(null, ctx.Identifier().getText());
}
for(SimpleJavaParser.ChainedMethodContext chainedMethod : ctx.chainedMethod()) {
methodCallStatementExpressionNode.addChainedMethod((ChainedMethodNode) visit(chainedMethod));
}
for(SimpleJavaParser.ExpressionContext expression : ctx.argumentList().expression()) {
methodCallStatementExpressionNode.addExpression((IExpressionNode) visit(expression));
}
return methodCallStatementExpressionNode;
}
/**
* Visits the target of a method call and creates a TargetNode.
* It handles various types of targets including 'this', member access, new declarations, and identifiers.
*
* @param ctx the target context
* @return the AST node for the target
*/
@Override
public ASTNode visitTarget(SimpleJavaParser.TargetContext ctx) {
if(ctx.This() != null) {
return new TargetNode(true);
} else if(ctx.memberAccess() != null) {
return new TargetNode((MemberAccessNode) visit(ctx.memberAccess()));
} else if(ctx.newDeclaration() != null) {
return new TargetNode((NewDeclarationNode) visit(ctx.newDeclaration()));
} else if(ctx.Identifier() != null) {
return new TargetNode(ctx.Identifier().getText());
}
return null;
}
/**
* Visits a chained method and creates a ChainedMethodNode.
* It processes the identifier and the argument list.
*
* @param ctx the chained method context
* @return the AST node for the chained method
*/
@Override
public ASTNode visitChainedMethod(SimpleJavaParser.ChainedMethodContext ctx) {
ChainedMethodNode chainedMethodNode = new ChainedMethodNode(ctx.Identifier().getText());
for(SimpleJavaParser.ExpressionContext expression : ctx.argumentList().expression()) {
chainedMethodNode.addExpression((IExpressionNode) visit(expression));
}
return chainedMethodNode;
}
/**
* Visits an increment or decrement expression and creates the corresponding AST node.
* It handles both prefix and suffix forms of increment and decrement.
*
* @param ctx the crement expression context
* @return the AST node for the crement expression
*/
@Override
public ASTNode visitCrementExpression(SimpleJavaParser.CrementExpressionContext ctx) {
if(ctx.incrementExpression() != null) {
return visitIncrementExpression(ctx.incrementExpression());
} else if(ctx.decrementExpression() != null) {
return visitDecrementExpression(ctx.decrementExpression());
}
return null;
}
/**
* Visits an increment expression and creates an IncrementNode.
* It handles both prefix and suffix forms.
*
* @param ctx the increment expression context
* @return the AST node for the increment expression
*/
@Override
public ASTNode visitIncrementExpression(SimpleJavaParser.IncrementExpressionContext ctx) {
if(ctx.prefixIncrementExpression() != null) {
return visitPrefixIncrementExpression(ctx.prefixIncrementExpression());
} else if(ctx.suffixIncrementExpression() != null) {
return visitSuffixIncrementExpression(ctx.suffixIncrementExpression());
}
return null;
}
/**
* Visits a prefix increment expression and creates an IncrementNode.
*
* @param ctx the prefix increment expression context
* @return the AST node for the prefix increment expression
*/
@Override
public ASTNode visitPrefixIncrementExpression(SimpleJavaParser.PrefixIncrementExpressionContext ctx) {
return new IncrementNode(CrementType.PREFIX, (AssignableNode) visit(ctx.assignableExpression()));
}
/**
* Visits a suffix increment expression and creates an IncrementNode.
*
* @param ctx the suffix increment expression context
* @return the AST node for the suffix increment expression
*/
@Override
public ASTNode visitSuffixIncrementExpression(SimpleJavaParser.SuffixIncrementExpressionContext ctx) {
return new IncrementNode(CrementType.SUFFIX, (AssignableNode) visit(ctx.assignableExpression()));
}
/**
* Visits a decrement expression and creates a DecrementNode.
* It handles both prefix and suffix forms.
*
* @param ctx the decrement expression context
* @return the AST node for the decrement expression
*/
@Override
public ASTNode visitDecrementExpression(SimpleJavaParser.DecrementExpressionContext ctx) {
if(ctx.prefixDecrementExpression() != null) {
return visitPrefixDecrementExpression(ctx.prefixDecrementExpression());
} else if(ctx.suffixDecrementExpression() != null) {
return visitSuffixDecrementExpression(ctx.suffixDecrementExpression());
}
return null;
}
/**
* Visits a prefix decrement expression and creates a DecrementNode.
*
* @param ctx the prefix decrement expression context
* @return the AST node for the prefix decrement expression
*/
@Override
public ASTNode visitPrefixDecrementExpression(SimpleJavaParser.PrefixDecrementExpressionContext ctx) {
return new DecrementNode(CrementType.PREFIX, (AssignableNode) visit(ctx.assignableExpression()));
}
/**
* Visits a suffix decrement expression and creates a DecrementNode.
*
* @param ctx the suffix decrement expression context
* @return the AST node for the suffix decrement expression
*/
@Override
public ASTNode visitSuffixDecrementExpression(SimpleJavaParser.SuffixDecrementExpressionContext ctx) {
return new DecrementNode(CrementType.SUFFIX, (AssignableNode) visit(ctx.assignableExpression()));
}
/**
* Visits an expression and creates the corresponding AST node.
* It handles both unary and binary expressions.
*
* @param ctx the expression context
* @return the AST node for the expression
*/
@Override
public ASTNode visitExpression(SimpleJavaParser.ExpressionContext ctx) {
if(ctx.unaryExpression() != null) {
return visit(ctx.unaryExpression());
} else if(ctx.binaryExpression() != null) {
return visit(ctx.binaryExpression());
}
return null;
}
/**
* Visits a unary expression and creates a UnaryNode.
* It handles various forms of unary expressions including 'this', identifiers, member access, values, and more.
*
* @param ctx the unary expression context
* @return the AST node for the unary expression
*/
@Override
public ASTNode visitUnaryExpression(SimpleJavaParser.UnaryExpressionContext ctx) {
if(ctx.This() != null) {
return new UnaryNode(ctx.This().getText());
} else if(ctx.Identifier() != null) {
return new UnaryNode(ctx.Identifier().getText());
} else if(ctx.memberAccess() != null) {
return new UnaryNode((MemberAccessNode) visitMemberAccess(ctx.memberAccess()));
} else if(ctx.value() != null) {
return new UnaryNode((ValueNode) visitValue(ctx.value()));
} else if(ctx.notExpression() != null) {
return new UnaryNode((NotNode) visitNotExpression(ctx.notExpression()));
} else if(ctx.statementExpression() != null) {
return new UnaryNode((IStatementNode) visitStatementExpression(ctx.statementExpression()));
} else if(ctx.expression() != null) {
return new UnaryNode((IExpressionNode) visitExpression(ctx.expression()));
}
return null;
}
/**
* Visits a member access expression and creates a MemberAccessNode.
* It processes the 'this' keyword and identifiers for member access.
*
* @param ctx the member access context
* @return the AST node for the member access
*/
@Override
public ASTNode visitMemberAccess(SimpleJavaParser.MemberAccessContext ctx) {
MemberAccessNode memberAccessNode;
if(ctx.This() != null) {
memberAccessNode = new MemberAccessNode(true);
} else {
memberAccessNode = new MemberAccessNode(false);
}
for (TerminalNode identifierNode : ctx.Identifier()) {
memberAccessNode.addIdentifier(identifierNode.getText());
}
return memberAccessNode;
}
/**
* Visits a value and creates a ValueNode.
* It handles integer, boolean, char, and null values.
*
* @param ctx the value context
* @return the AST node for the value
*/
@Override
public ASTNode visitValue(SimpleJavaParser.ValueContext ctx) {
if(ctx.IntValue() != null) {
return new ValueNode(EnumValueNode.INT_VALUE, ctx.IntValue().getText());
} else if(ctx.BooleanValue() != null) {
return new ValueNode(EnumValueNode.BOOLEAN_VALUE, ctx.BooleanValue().getText());
} else if(ctx.CharValue() != null) {
return new ValueNode(EnumValueNode.CHAR_VALUE, ctx.CharValue().getText());
} else if(ctx.NullValue() != null) {
return new ValueNode(EnumValueNode.NULL_VALUE, ctx.NullValue().getText());
}
return null;
}
/**
* Visits a not expression and creates a NotNode.
* It processes the expression to which the 'not' operator is applied.
*
* @param ctx the not expression context
* @return the AST node for the not expression
*/
@Override
public ASTNode visitNotExpression(SimpleJavaParser.NotExpressionContext ctx) {
return new NotNode((IExpressionNode) visitExpression(ctx.expression()));
}
/**
* Visits a binary expression and creates the corresponding AST node.
* It handles both calculation and non-calculation expressions.
*
* @param ctx the binary expression context
* @return the AST node for the binary expression
*/
@Override
public ASTNode visitBinaryExpression(SimpleJavaParser.BinaryExpressionContext ctx) {
if(ctx.calculationExpression() != null) {
return visit(ctx.calculationExpression());
} else if(ctx.nonCalculationExpression() != null) {
return visit(ctx.nonCalculationExpression());
}
return null;
}
/**
* Visits a calculation expression and creates a CalculationNode.
* It handles line operators and dot expressions.
*
* @param ctx the calculation expression context
* @return the AST node for the calculation expression
*/
@Override
public ASTNode visitCalculationExpression(SimpleJavaParser.CalculationExpressionContext ctx) {
if(ctx.calculationExpression() != null) {
return new CalculationNode((CalculationNode) visit(ctx.calculationExpression()), ctx.LineOperator().getText(), (DotNode) visit(ctx.dotExpression()));
} else if(ctx.dotExpression() != null) {
return new CalculationNode((DotNode) visit(ctx.dotExpression()));
}
return null;
}
/**
* Visits a dot expression and creates a DotNode.
* It handles dot operators and dot subtraction expressions.
*
* @param ctx the dot expression context
* @return the AST node for the dot expression
*/
@Override
public ASTNode visitDotExpression(SimpleJavaParser.DotExpressionContext ctx) {
if(ctx.dotExpression() != null) {
return new DotNode((DotNode) visit(ctx.dotExpression()), ctx.DotOperator().getText(), (DotSubtractionNode) visit(ctx.dotSubtractionExpression()));
} else if(ctx.dotSubtractionExpression() != null) {
return new DotNode((DotSubtractionNode) visit(ctx.dotSubtractionExpression()));
}
return null;
}
/**
* Visits a dot subtraction expression and creates a DotSubtractionNode.
* It handles integer values, identifiers, member access, and method calls.
*
* @param ctx the dot subtraction expression context
* @return the AST node for the dot subtraction expression
*//**
* Creates an ITypeNode based on the type identifier.
* It handles basic types and reference types.
*
* @param identifier the type identifier
* @return the type node
*/
@Override
public ASTNode visitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx) {
if(ctx.IntValue() != null) {
return new DotSubtractionNode(new ValueNode(EnumValueNode.INT_VALUE, ctx.IntValue().getText()));
} else if(ctx.Identifier() != null) {
return new DotSubtractionNode(ctx.Identifier().getText());
} else if(ctx.memberAccess() != null) {
return new DotSubtractionNode((MemberAccessNode) visit(ctx.memberAccess()));
} else if(ctx.methodCall() != null && ctx.calculationExpression() != null) {
return new DotSubtractionNode((MethodCallNode) visit(ctx.methodCall()), (CalculationNode) visit(ctx.calculationExpression()));
}
return null;
}
/**
* Visits a non-calculation expression and creates a NonCalculationNode.
* It handles unary expressions combined with non-calculation operators.
*
* @param ctx the non-calculation expression context
* @return the AST node for the non-calculation expression
*/
@Override
public ASTNode visitNonCalculationExpression(SimpleJavaParser.NonCalculationExpressionContext ctx) {
return new NonCalculationNode((UnaryNode) visit(ctx.unaryExpression()), ctx.nonCalculationOperator().getText(), (IExpressionNode) visit(ctx.expression()));
}
/**
* Visits an assignable expression and creates an AssignableNode.
* It handles identifiers and member access.
*
* @param ctx the assignable expression context
* @return the AST node for the assignable expression
*/
@Override
public ASTNode visitAssignableExpression(SimpleJavaParser.AssignableExpressionContext ctx) {
if(ctx.Identifier() != null) {
return new AssignableNode(ctx.Identifier().getText());
} else if(ctx.memberAccess() != null) {
return new AssignableNode((MemberAccessNode) visit(ctx.memberAccess()));
}
return null;
}
/**
* Creates an ITypeNode based on the type identifier.
* It handles basic types and reference types.
*
* @param identifier the type identifier
* @return the type node
*/
public ITypeNode createTypeNode(String identifier){
return switch (identifier) {
case "int" -> new BaseType(TypeEnum.INT);
case "boolean" -> new BaseType(TypeEnum.BOOL);
case "char" -> new BaseType(TypeEnum.CHAR);
case "void" -> new BaseType(TypeEnum.VOID);
default -> new ReferenceType(identifier);
};
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,73 +1,98 @@
T__0=1
T__1=2
T__2=3
T__3=4
T__4=5
T__5=6
T__6=7
T__7=8
T__8=9
T__9=10
T__10=11
T__11=12
T__12=13
T__13=14
T__14=15
T__15=16
T__16=17
T__17=18
T__18=19
T__19=20
T__20=21
T__21=22
T__22=23
T__23=24
T__24=25
T__25=26
T__26=27
T__27=28
T__28=29
T__29=30
T__30=31
T__31=32
T__32=33
T__33=34
T__34=35
INTEGERLITERAL=36
IDENTIFIER=37
WS=38
'class'=1
'{'=2
'}'=3
';'=4
'static'=5
'('=6
')'=7
','=8
'int'=9
'boolean'=10
'char'=11
'public'=12
'private'=13
'='=14
'if'=15
'else'=16
'while'=17
'return'=18
'&&'=19
'||'=20
'=='=21
'!='=22
'<'=23
'<='=24
'>'=25
'>='=26
'+'=27
'-'=28
'*'=29
'/'=30
'%'=31
'!'=32
'true'=33
'false'=34
'\''=35
Void=3
Boolean=4
Char=5
Int=6
AccessModifier=7
MainMethodDeclaration=8
DotOperator=9
LineOperator=10
ComparisonOperator=11
LogicalOperator=12
Assign=13
Plus=14
Minus=15
Mult=16
Modulo=17
Div=18
Greater=19
Less=20
GreaterEqual=21
LessEqual=22
Equal=23
NotEqual=24
Not=25
And=26
Or=27
Dot=28
OpenRoundBracket=29
ClosedRoundBracket=30
OpenCurlyBracket=31
ClosedCurlyBracket=32
Semicolon=33
Comma=34
Class=35
This=36
While=37
Do=38
If=39
Else=40
For=41
Return=42
New=43
Switch=44
Case=45
Default=46
Colon=47
CharValue=48
IntValue=49
BooleanValue=50
NullValue=51
Identifier=52
WS=53
InlineComment=54
MultilineComment=55
'++'=1
'--'=2
'void'=3
'boolean'=4
'char'=5
'int'=6
'public static void main(String[] args)'=8
'='=13
'+'=14
'-'=15
'*'=16
'%'=17
'/'=18
'>'=19
'<'=20
'>='=21
'<='=22
'=='=23
'!='=24
'!'=25
'&&'=26
'||'=27
'.'=28
'('=29
')'=30
'{'=31
'}'=32
';'=33
','=34
'class'=35
'this'=36
'while'=37
'do'=38
'if'=39
'else'=40
'for'=41
'return'=42
'new'=43
'switch'=44
'case'=45
'default'=46
':'=47
'null'=51

View File

@@ -1,4 +1,4 @@
// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
// Generated from C:/Users/Maxi/Documents/DHBW/Compilerbau/NichtHaskell2.0/src/main/java/parser/grammar/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.ParserRuleContext;
@@ -48,6 +48,18 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
@@ -101,25 +113,13 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterType(SimpleJavaParser.TypeContext ctx) { }
@Override public void enterArgumentList(SimpleJavaParser.ArgumentListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitType(SimpleJavaParser.TypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAccessType(SimpleJavaParser.AccessTypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAccessType(SimpleJavaParser.AccessTypeContext ctx) { }
@Override public void exitArgumentList(SimpleJavaParser.ArgumentListContext ctx) { }
/**
* {@inheritDoc}
*
@@ -137,49 +137,13 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx) { }
@Override public void enterBlockStatement(SimpleJavaParser.BlockStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIfStatement(SimpleJavaParser.IfStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIfStatement(SimpleJavaParser.IfStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { }
@Override public void exitBlockStatement(SimpleJavaParser.BlockStatementContext ctx) { }
/**
* {@inheritDoc}
*
@@ -197,13 +161,169 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBlock(SimpleJavaParser.BlockContext ctx) { }
@Override public void enterLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBlock(SimpleJavaParser.BlockContext ctx) { }
@Override public void exitLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDoWhileStatement(SimpleJavaParser.DoWhileStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDoWhileStatement(SimpleJavaParser.DoWhileStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterForStatement(SimpleJavaParser.ForStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitForStatement(SimpleJavaParser.ForStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIfElseStatement(SimpleJavaParser.IfElseStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIfElseStatement(SimpleJavaParser.IfElseStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIfStatement(SimpleJavaParser.IfStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIfStatement(SimpleJavaParser.IfStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterElseIfStatement(SimpleJavaParser.ElseIfStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitElseIfStatement(SimpleJavaParser.ElseIfStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterElseStatement(SimpleJavaParser.ElseStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitElseStatement(SimpleJavaParser.ElseStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterCaseStatement(SimpleJavaParser.CaseStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitCaseStatement(SimpleJavaParser.CaseStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStatementExpression(SimpleJavaParser.StatementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStatementExpression(SimpleJavaParser.StatementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAssign(SimpleJavaParser.AssignContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAssign(SimpleJavaParser.AssignContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNewDeclaration(SimpleJavaParser.NewDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNewDeclaration(SimpleJavaParser.NewDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
@@ -221,37 +341,265 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLiteral(SimpleJavaParser.LiteralContext ctx) { }
@Override public void enterUnaryExpression(SimpleJavaParser.UnaryExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLiteral(SimpleJavaParser.LiteralContext ctx) { }
@Override public void exitUnaryExpression(SimpleJavaParser.UnaryExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx) { }
@Override public void enterNotExpression(SimpleJavaParser.NotExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx) { }
@Override public void exitNotExpression(SimpleJavaParser.NotExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterCharLiteral(SimpleJavaParser.CharLiteralContext ctx) { }
@Override public void enterCrementExpression(SimpleJavaParser.CrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitCharLiteral(SimpleJavaParser.CharLiteralContext ctx) { }
@Override public void exitCrementExpression(SimpleJavaParser.CrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterIncrementExpression(SimpleJavaParser.IncrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitIncrementExpression(SimpleJavaParser.IncrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPrefixIncrementExpression(SimpleJavaParser.PrefixIncrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPrefixIncrementExpression(SimpleJavaParser.PrefixIncrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSuffixIncrementExpression(SimpleJavaParser.SuffixIncrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSuffixIncrementExpression(SimpleJavaParser.SuffixIncrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDecrementExpression(SimpleJavaParser.DecrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDecrementExpression(SimpleJavaParser.DecrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterPrefixDecrementExpression(SimpleJavaParser.PrefixDecrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitPrefixDecrementExpression(SimpleJavaParser.PrefixDecrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSuffixDecrementExpression(SimpleJavaParser.SuffixDecrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSuffixDecrementExpression(SimpleJavaParser.SuffixDecrementExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterAssignableExpression(SimpleJavaParser.AssignableExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitAssignableExpression(SimpleJavaParser.AssignableExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMemberAccess(SimpleJavaParser.MemberAccessContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMemberAccess(SimpleJavaParser.MemberAccessContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterBinaryExpression(SimpleJavaParser.BinaryExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitBinaryExpression(SimpleJavaParser.BinaryExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterCalculationExpression(SimpleJavaParser.CalculationExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitCalculationExpression(SimpleJavaParser.CalculationExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDotExpression(SimpleJavaParser.DotExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDotExpression(SimpleJavaParser.DotExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNonCalculationExpression(SimpleJavaParser.NonCalculationExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNonCalculationExpression(SimpleJavaParser.NonCalculationExpressionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterMethodCall(SimpleJavaParser.MethodCallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMethodCall(SimpleJavaParser.MethodCallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTarget(SimpleJavaParser.TargetContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTarget(SimpleJavaParser.TargetContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterChainedMethod(SimpleJavaParser.ChainedMethodContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitChainedMethod(SimpleJavaParser.ChainedMethodContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterType(SimpleJavaParser.TypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitType(SimpleJavaParser.TypeContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterValue(SimpleJavaParser.ValueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitValue(SimpleJavaParser.ValueContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterNonCalculationOperator(SimpleJavaParser.NonCalculationOperatorContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitNonCalculationOperator(SimpleJavaParser.NonCalculationOperatorContext ctx) { }
/**
* {@inheritDoc}

View File

@@ -1,4 +1,4 @@
// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
// Generated from C:/Users/Maxi/Documents/DHBW/Compilerbau/NichtHaskell2.0/src/main/java/parser/grammar/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
@@ -33,6 +33,13 @@ public class SimpleJavaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implem
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
@@ -67,14 +74,7 @@ public class SimpleJavaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implem
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitType(SimpleJavaParser.TypeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAccessType(SimpleJavaParser.AccessTypeContext ctx) { return visitChildren(ctx); }
@Override public T visitArgumentList(SimpleJavaParser.ArgumentListContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
@@ -88,28 +88,7 @@ public class SimpleJavaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implem
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIfStatement(SimpleJavaParser.IfStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { return visitChildren(ctx); }
@Override public T visitBlockStatement(SimpleJavaParser.BlockStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
@@ -123,7 +102,98 @@ public class SimpleJavaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implem
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBlock(SimpleJavaParser.BlockContext ctx) { return visitChildren(ctx); }
@Override public T visitLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitWhileStatement(SimpleJavaParser.WhileStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDoWhileStatement(SimpleJavaParser.DoWhileStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitForStatement(SimpleJavaParser.ForStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIfElseStatement(SimpleJavaParser.IfElseStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIfStatement(SimpleJavaParser.IfStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitElseIfStatement(SimpleJavaParser.ElseIfStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitElseStatement(SimpleJavaParser.ElseStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitCaseStatement(SimpleJavaParser.CaseStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStatementExpression(SimpleJavaParser.StatementExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAssign(SimpleJavaParser.AssignContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNewDeclaration(SimpleJavaParser.NewDeclarationContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
@@ -137,19 +207,152 @@ public class SimpleJavaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implem
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLiteral(SimpleJavaParser.LiteralContext ctx) { return visitChildren(ctx); }
@Override public T visitUnaryExpression(SimpleJavaParser.UnaryExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx) { return visitChildren(ctx); }
@Override public T visitNotExpression(SimpleJavaParser.NotExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitCharLiteral(SimpleJavaParser.CharLiteralContext ctx) { return visitChildren(ctx); }
@Override public T visitCrementExpression(SimpleJavaParser.CrementExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitIncrementExpression(SimpleJavaParser.IncrementExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPrefixIncrementExpression(SimpleJavaParser.PrefixIncrementExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSuffixIncrementExpression(SimpleJavaParser.SuffixIncrementExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDecrementExpression(SimpleJavaParser.DecrementExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitPrefixDecrementExpression(SimpleJavaParser.PrefixDecrementExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSuffixDecrementExpression(SimpleJavaParser.SuffixDecrementExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitAssignableExpression(SimpleJavaParser.AssignableExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMemberAccess(SimpleJavaParser.MemberAccessContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitBinaryExpression(SimpleJavaParser.BinaryExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitCalculationExpression(SimpleJavaParser.CalculationExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDotExpression(SimpleJavaParser.DotExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNonCalculationExpression(SimpleJavaParser.NonCalculationExpressionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMethodCall(SimpleJavaParser.MethodCallContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTarget(SimpleJavaParser.TargetContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitChainedMethod(SimpleJavaParser.ChainedMethodContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitType(SimpleJavaParser.TypeContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitValue(SimpleJavaParser.ValueContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitNonCalculationOperator(SimpleJavaParser.NonCalculationOperatorContext ctx) { return visitChildren(ctx); }
}

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
// Generated from C:/Users/Maxi/Documents/DHBW/Compilerbau/NichtHaskell2.0/src/main/java/parser/grammar/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
@@ -17,12 +17,15 @@ public class SimpleJavaLexer extends Lexer {
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
T__0=1, T__1=2, T__2=3, T__3=4, T__4=5, T__5=6, T__6=7, T__7=8, T__8=9,
T__9=10, T__10=11, T__11=12, T__12=13, T__13=14, T__14=15, T__15=16, T__16=17,
T__17=18, T__18=19, T__19=20, T__20=21, T__21=22, T__22=23, T__23=24,
T__24=25, T__25=26, T__26=27, T__27=28, T__28=29, T__29=30, T__30=31,
T__31=32, T__32=33, T__33=34, T__34=35, INTEGERLITERAL=36, IDENTIFIER=37,
WS=38;
T__0=1, T__1=2, Void=3, Boolean=4, Char=5, Int=6, AccessModifier=7, MainMethodDeclaration=8,
DotOperator=9, LineOperator=10, ComparisonOperator=11, LogicalOperator=12,
Assign=13, Plus=14, Minus=15, Mult=16, Modulo=17, Div=18, Greater=19,
Less=20, GreaterEqual=21, LessEqual=22, Equal=23, NotEqual=24, Not=25,
And=26, Or=27, Dot=28, OpenRoundBracket=29, ClosedRoundBracket=30, OpenCurlyBracket=31,
ClosedCurlyBracket=32, Semicolon=33, Comma=34, Class=35, This=36, While=37,
Do=38, If=39, Else=40, For=41, Return=42, New=43, Switch=44, Case=45,
Default=46, Colon=47, CharValue=48, IntValue=49, BooleanValue=50, NullValue=51,
Identifier=52, WS=53, InlineComment=54, MultilineComment=55;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
@@ -33,31 +36,43 @@ public class SimpleJavaLexer extends Lexer {
private static String[] makeRuleNames() {
return new String[] {
"T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "T__8",
"T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16",
"T__17", "T__18", "T__19", "T__20", "T__21", "T__22", "T__23", "T__24",
"T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32",
"T__33", "T__34", "INTEGERLITERAL", "IDENTIFIER", "WS"
"T__0", "T__1", "Void", "Boolean", "Char", "Int", "AccessModifier", "MainMethodDeclaration",
"DotOperator", "LineOperator", "ComparisonOperator", "LogicalOperator",
"Assign", "Plus", "Minus", "Mult", "Modulo", "Div", "Greater", "Less",
"GreaterEqual", "LessEqual", "Equal", "NotEqual", "Not", "And", "Or",
"Dot", "OpenRoundBracket", "ClosedRoundBracket", "OpenCurlyBracket",
"ClosedCurlyBracket", "Semicolon", "Comma", "Class", "This", "While",
"Do", "If", "Else", "For", "Return", "New", "Switch", "Case", "Default",
"Colon", "CharValue", "IntValue", "BooleanValue", "NullValue", "Alphabetic",
"Numeric", "ValidIdentSymbols", "Identifier", "WS", "InlineComment",
"MultilineComment"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "'class'", "'{'", "'}'", "';'", "'static'", "'('", "')'", "','",
"'int'", "'boolean'", "'char'", "'public'", "'private'", "'='", "'if'",
"'else'", "'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'",
"'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'",
"'false'", "'''"
null, "'++'", "'--'", "'void'", "'boolean'", "'char'", "'int'", null,
"'public static void main(String[] args)'", null, null, null, null, "'='",
"'+'", "'-'", "'*'", "'%'", "'/'", "'>'", "'<'", "'>='", "'<='", "'=='",
"'!='", "'!'", "'&&'", "'||'", "'.'", "'('", "')'", "'{'", "'}'", "';'",
"','", "'class'", "'this'", "'while'", "'do'", "'if'", "'else'", "'for'",
"'return'", "'new'", "'switch'", "'case'", "'default'", "':'", null,
null, null, "'null'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
null, null, null, null, null, null, null, null, null, null, null, null,
"INTEGERLITERAL", "IDENTIFIER", "WS"
null, null, null, "Void", "Boolean", "Char", "Int", "AccessModifier",
"MainMethodDeclaration", "DotOperator", "LineOperator", "ComparisonOperator",
"LogicalOperator", "Assign", "Plus", "Minus", "Mult", "Modulo", "Div",
"Greater", "Less", "GreaterEqual", "LessEqual", "Equal", "NotEqual",
"Not", "And", "Or", "Dot", "OpenRoundBracket", "ClosedRoundBracket",
"OpenCurlyBracket", "ClosedCurlyBracket", "Semicolon", "Comma", "Class",
"This", "While", "Do", "If", "Else", "For", "Return", "New", "Switch",
"Case", "Default", "Colon", "CharValue", "IntValue", "BooleanValue",
"NullValue", "Identifier", "WS", "InlineComment", "MultilineComment"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
@@ -119,7 +134,7 @@ public class SimpleJavaLexer extends Lexer {
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\u0004\u0000&\u00df\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
"\u0004\u00007\u01bb\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
"\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+
"\u0007\u0004\u0002\u0005\u0007\u0005\u0002\u0006\u0007\u0006\u0002\u0007"+
"\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+
@@ -130,128 +145,267 @@ public class SimpleJavaLexer extends Lexer {
"\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+
"\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+
"\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+
"!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0001\u0000"+
"\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001"+
"\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004"+
"\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004"+
"\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007"+
"\u0001\b\u0001\b\u0001\b\u0001\b\u0001\t\u0001\t\u0001\t\u0001\t\u0001"+
"\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001"+
"\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001\u000b\u0001"+
"\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f"+
"\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001"+
"\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001"+
"\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001"+
"\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+
"\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0014\u0001"+
"\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0001"+
"\u0016\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001"+
"\u0019\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a\u0001\u001b\u0001"+
"\u001b\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001e\u0001"+
"\u001e\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001"+
"!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001\"\u0001\"\u0001#\u0004#\u00ce"+
"\b#\u000b#\f#\u00cf\u0001$\u0001$\u0005$\u00d4\b$\n$\f$\u00d7\t$\u0001"+
"%\u0004%\u00da\b%\u000b%\f%\u00db\u0001%\u0001%\u0000\u0000&\u0001\u0001"+
"\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f"+
"\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f"+
"\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016-\u0017/\u0018"+
"1\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f? A!C\"E#G$I%K&\u0001"+
"\u0000\u0004\u0001\u000009\u0002\u0000AZaz\u0004\u000009AZ__az\u0003\u0000"+
"\t\n\r\r \u00e1\u0000\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001"+
"\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001"+
"\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000"+
"\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000"+
"\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000"+
"\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000"+
"\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000"+
"\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f\u0001\u0000\u0000"+
"\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000\u0000\u0000\u0000"+
"%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000\u0000\u0000)\u0001"+
"\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000-\u0001\u0000\u0000"+
"\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001\u0000\u0000\u0000\u0000"+
"3\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000\u0000\u00007\u0001"+
"\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000;\u0001\u0000\u0000"+
"\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?\u0001\u0000\u0000\u0000\u0000"+
"A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000\u0000\u0000E\u0001"+
"\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000I\u0001\u0000\u0000"+
"\u0000\u0000K\u0001\u0000\u0000\u0000\u0001M\u0001\u0000\u0000\u0000\u0003"+
"S\u0001\u0000\u0000\u0000\u0005U\u0001\u0000\u0000\u0000\u0007W\u0001"+
"\u0000\u0000\u0000\tY\u0001\u0000\u0000\u0000\u000b`\u0001\u0000\u0000"+
"\u0000\rb\u0001\u0000\u0000\u0000\u000fd\u0001\u0000\u0000\u0000\u0011"+
"f\u0001\u0000\u0000\u0000\u0013j\u0001\u0000\u0000\u0000\u0015r\u0001"+
"\u0000\u0000\u0000\u0017w\u0001\u0000\u0000\u0000\u0019~\u0001\u0000\u0000"+
"\u0000\u001b\u0086\u0001\u0000\u0000\u0000\u001d\u0088\u0001\u0000\u0000"+
"\u0000\u001f\u008b\u0001\u0000\u0000\u0000!\u0090\u0001\u0000\u0000\u0000"+
"#\u0096\u0001\u0000\u0000\u0000%\u009d\u0001\u0000\u0000\u0000\'\u00a0"+
"\u0001\u0000\u0000\u0000)\u00a3\u0001\u0000\u0000\u0000+\u00a6\u0001\u0000"+
"\u0000\u0000-\u00a9\u0001\u0000\u0000\u0000/\u00ab\u0001\u0000\u0000\u0000"+
"1\u00ae\u0001\u0000\u0000\u00003\u00b0\u0001\u0000\u0000\u00005\u00b3"+
"\u0001\u0000\u0000\u00007\u00b5\u0001\u0000\u0000\u00009\u00b7\u0001\u0000"+
"\u0000\u0000;\u00b9\u0001\u0000\u0000\u0000=\u00bb\u0001\u0000\u0000\u0000"+
"?\u00bd\u0001\u0000\u0000\u0000A\u00bf\u0001\u0000\u0000\u0000C\u00c4"+
"\u0001\u0000\u0000\u0000E\u00ca\u0001\u0000\u0000\u0000G\u00cd\u0001\u0000"+
"\u0000\u0000I\u00d1\u0001\u0000\u0000\u0000K\u00d9\u0001\u0000\u0000\u0000"+
"MN\u0005c\u0000\u0000NO\u0005l\u0000\u0000OP\u0005a\u0000\u0000PQ\u0005"+
"s\u0000\u0000QR\u0005s\u0000\u0000R\u0002\u0001\u0000\u0000\u0000ST\u0005"+
"{\u0000\u0000T\u0004\u0001\u0000\u0000\u0000UV\u0005}\u0000\u0000V\u0006"+
"\u0001\u0000\u0000\u0000WX\u0005;\u0000\u0000X\b\u0001\u0000\u0000\u0000"+
"YZ\u0005s\u0000\u0000Z[\u0005t\u0000\u0000[\\\u0005a\u0000\u0000\\]\u0005"+
"t\u0000\u0000]^\u0005i\u0000\u0000^_\u0005c\u0000\u0000_\n\u0001\u0000"+
"\u0000\u0000`a\u0005(\u0000\u0000a\f\u0001\u0000\u0000\u0000bc\u0005)"+
"\u0000\u0000c\u000e\u0001\u0000\u0000\u0000de\u0005,\u0000\u0000e\u0010"+
"\u0001\u0000\u0000\u0000fg\u0005i\u0000\u0000gh\u0005n\u0000\u0000hi\u0005"+
"t\u0000\u0000i\u0012\u0001\u0000\u0000\u0000jk\u0005b\u0000\u0000kl\u0005"+
"o\u0000\u0000lm\u0005o\u0000\u0000mn\u0005l\u0000\u0000no\u0005e\u0000"+
"\u0000op\u0005a\u0000\u0000pq\u0005n\u0000\u0000q\u0014\u0001\u0000\u0000"+
"\u0000rs\u0005c\u0000\u0000st\u0005h\u0000\u0000tu\u0005a\u0000\u0000"+
"uv\u0005r\u0000\u0000v\u0016\u0001\u0000\u0000\u0000wx\u0005p\u0000\u0000"+
"xy\u0005u\u0000\u0000yz\u0005b\u0000\u0000z{\u0005l\u0000\u0000{|\u0005"+
"i\u0000\u0000|}\u0005c\u0000\u0000}\u0018\u0001\u0000\u0000\u0000~\u007f"+
"\u0005p\u0000\u0000\u007f\u0080\u0005r\u0000\u0000\u0080\u0081\u0005i"+
"\u0000\u0000\u0081\u0082\u0005v\u0000\u0000\u0082\u0083\u0005a\u0000\u0000"+
"\u0083\u0084\u0005t\u0000\u0000\u0084\u0085\u0005e\u0000\u0000\u0085\u001a"+
"\u0001\u0000\u0000\u0000\u0086\u0087\u0005=\u0000\u0000\u0087\u001c\u0001"+
"\u0000\u0000\u0000\u0088\u0089\u0005i\u0000\u0000\u0089\u008a\u0005f\u0000"+
"\u0000\u008a\u001e\u0001\u0000\u0000\u0000\u008b\u008c\u0005e\u0000\u0000"+
"\u008c\u008d\u0005l\u0000\u0000\u008d\u008e\u0005s\u0000\u0000\u008e\u008f"+
"\u0005e\u0000\u0000\u008f \u0001\u0000\u0000\u0000\u0090\u0091\u0005w"+
"\u0000\u0000\u0091\u0092\u0005h\u0000\u0000\u0092\u0093\u0005i\u0000\u0000"+
"\u0093\u0094\u0005l\u0000\u0000\u0094\u0095\u0005e\u0000\u0000\u0095\""+
"\u0001\u0000\u0000\u0000\u0096\u0097\u0005r\u0000\u0000\u0097\u0098\u0005"+
"e\u0000\u0000\u0098\u0099\u0005t\u0000\u0000\u0099\u009a\u0005u\u0000"+
"\u0000\u009a\u009b\u0005r\u0000\u0000\u009b\u009c\u0005n\u0000\u0000\u009c"+
"$\u0001\u0000\u0000\u0000\u009d\u009e\u0005&\u0000\u0000\u009e\u009f\u0005"+
"&\u0000\u0000\u009f&\u0001\u0000\u0000\u0000\u00a0\u00a1\u0005|\u0000"+
"\u0000\u00a1\u00a2\u0005|\u0000\u0000\u00a2(\u0001\u0000\u0000\u0000\u00a3"+
"\u00a4\u0005=\u0000\u0000\u00a4\u00a5\u0005=\u0000\u0000\u00a5*\u0001"+
"\u0000\u0000\u0000\u00a6\u00a7\u0005!\u0000\u0000\u00a7\u00a8\u0005=\u0000"+
"\u0000\u00a8,\u0001\u0000\u0000\u0000\u00a9\u00aa\u0005<\u0000\u0000\u00aa"+
".\u0001\u0000\u0000\u0000\u00ab\u00ac\u0005<\u0000\u0000\u00ac\u00ad\u0005"+
"=\u0000\u0000\u00ad0\u0001\u0000\u0000\u0000\u00ae\u00af\u0005>\u0000"+
"\u0000\u00af2\u0001\u0000\u0000\u0000\u00b0\u00b1\u0005>\u0000\u0000\u00b1"+
"\u00b2\u0005=\u0000\u0000\u00b24\u0001\u0000\u0000\u0000\u00b3\u00b4\u0005"+
"+\u0000\u0000\u00b46\u0001\u0000\u0000\u0000\u00b5\u00b6\u0005-\u0000"+
"\u0000\u00b68\u0001\u0000\u0000\u0000\u00b7\u00b8\u0005*\u0000\u0000\u00b8"+
":\u0001\u0000\u0000\u0000\u00b9\u00ba\u0005/\u0000\u0000\u00ba<\u0001"+
"\u0000\u0000\u0000\u00bb\u00bc\u0005%\u0000\u0000\u00bc>\u0001\u0000\u0000"+
"\u0000\u00bd\u00be\u0005!\u0000\u0000\u00be@\u0001\u0000\u0000\u0000\u00bf"+
"\u00c0\u0005t\u0000\u0000\u00c0\u00c1\u0005r\u0000\u0000\u00c1\u00c2\u0005"+
"u\u0000\u0000\u00c2\u00c3\u0005e\u0000\u0000\u00c3B\u0001\u0000\u0000"+
"\u0000\u00c4\u00c5\u0005f\u0000\u0000\u00c5\u00c6\u0005a\u0000\u0000\u00c6"+
"\u00c7\u0005l\u0000\u0000\u00c7\u00c8\u0005s\u0000\u0000\u00c8\u00c9\u0005"+
"e\u0000\u0000\u00c9D\u0001\u0000\u0000\u0000\u00ca\u00cb\u0005\'\u0000"+
"\u0000\u00cbF\u0001\u0000\u0000\u0000\u00cc\u00ce\u0007\u0000\u0000\u0000"+
"\u00cd\u00cc\u0001\u0000\u0000\u0000\u00ce\u00cf\u0001\u0000\u0000\u0000"+
"\u00cf\u00cd\u0001\u0000\u0000\u0000\u00cf\u00d0\u0001\u0000\u0000\u0000"+
"\u00d0H\u0001\u0000\u0000\u0000\u00d1\u00d5\u0007\u0001\u0000\u0000\u00d2"+
"\u00d4\u0007\u0002\u0000\u0000\u00d3\u00d2\u0001\u0000\u0000\u0000\u00d4"+
"\u00d7\u0001\u0000\u0000\u0000\u00d5\u00d3\u0001\u0000\u0000\u0000\u00d5"+
"\u00d6\u0001\u0000\u0000\u0000\u00d6J\u0001\u0000\u0000\u0000\u00d7\u00d5"+
"\u0001\u0000\u0000\u0000\u00d8\u00da\u0007\u0003\u0000\u0000\u00d9\u00d8"+
"\u0001\u0000\u0000\u0000\u00da\u00db\u0001\u0000\u0000\u0000\u00db\u00d9"+
"\u0001\u0000\u0000\u0000\u00db\u00dc\u0001\u0000\u0000\u0000\u00dc\u00dd"+
"\u0001\u0000\u0000\u0000\u00dd\u00de\u0006%\u0000\u0000\u00deL\u0001\u0000"+
"\u0000\u0000\u0004\u0000\u00cf\u00d5\u00db\u0001\u0006\u0000\u0000";
"!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0002&\u0007"+
"&\u0002\'\u0007\'\u0002(\u0007(\u0002)\u0007)\u0002*\u0007*\u0002+\u0007"+
"+\u0002,\u0007,\u0002-\u0007-\u0002.\u0007.\u0002/\u0007/\u00020\u0007"+
"0\u00021\u00071\u00022\u00072\u00023\u00073\u00024\u00074\u00025\u0007"+
"5\u00026\u00076\u00027\u00077\u00028\u00078\u00029\u00079\u0001\u0000"+
"\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002"+
"\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003"+
"\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003\u0001\u0003"+
"\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005"+
"\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0006"+
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
"\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006\u0001\u0006"+
"\u0001\u0006\u0003\u0006\u00ba\b\u0006\u0001\u0007\u0001\u0007\u0001\u0007"+
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
"\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007\u0001\u0007"+
"\u0001\b\u0001\b\u0001\b\u0003\b\u00e6\b\b\u0001\t\u0001\t\u0003\t\u00ea"+
"\b\t\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0001\n\u0003\n\u00f2\b\n"+
"\u0001\u000b\u0001\u000b\u0003\u000b\u00f6\b\u000b\u0001\f\u0001\f\u0001"+
"\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u0010"+
"\u0001\u0010\u0001\u0011\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0013"+
"\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015"+
"\u0001\u0015\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017"+
"\u0001\u0017\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u0019"+
"\u0001\u001a\u0001\u001a\u0001\u001a\u0001\u001b\u0001\u001b\u0001\u001c"+
"\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001e\u0001\u001e\u0001\u001f"+
"\u0001\u001f\u0001 \u0001 \u0001!\u0001!\u0001\"\u0001\"\u0001\"\u0001"+
"\"\u0001\"\u0001\"\u0001#\u0001#\u0001#\u0001#\u0001#\u0001$\u0001$\u0001"+
"$\u0001$\u0001$\u0001$\u0001%\u0001%\u0001%\u0001&\u0001&\u0001&\u0001"+
"\'\u0001\'\u0001\'\u0001\'\u0001\'\u0001(\u0001(\u0001(\u0001(\u0001)"+
"\u0001)\u0001)\u0001)\u0001)\u0001)\u0001)\u0001*\u0001*\u0001*\u0001"+
"*\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001+\u0001,\u0001,\u0001"+
",\u0001,\u0001,\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001-\u0001"+
"-\u0001.\u0001.\u0001/\u0001/\u0005/\u016d\b/\n/\f/\u0170\t/\u0001/\u0001"+
"/\u00010\u00030\u0175\b0\u00010\u00040\u0178\b0\u000b0\f0\u0179\u0001"+
"1\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u00011\u00031\u0185"+
"\b1\u00012\u00012\u00012\u00012\u00012\u00013\u00013\u00014\u00014\u0001"+
"5\u00015\u00015\u00035\u0193\b5\u00016\u00016\u00056\u0197\b6\n6\f6\u019a"+
"\t6\u00017\u00047\u019d\b7\u000b7\f7\u019e\u00017\u00017\u00018\u0001"+
"8\u00018\u00018\u00058\u01a7\b8\n8\f8\u01aa\t8\u00018\u00018\u00019\u0001"+
"9\u00019\u00019\u00059\u01b2\b9\n9\f9\u01b5\t9\u00019\u00019\u00019\u0001"+
"9\u00019\u0001\u01b3\u0000:\u0001\u0001\u0003\u0002\u0005\u0003\u0007"+
"\u0004\t\u0005\u000b\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b"+
"\u0017\f\u0019\r\u001b\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013"+
"\'\u0014)\u0015+\u0016-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d"+
";\u001e=\u001f? A!C\"E#G$I%K&M\'O(Q)S*U+W,Y-[.]/_0a1c2e3g\u0000i\u0000"+
"k\u0000m4o5q6s7\u0001\u0000\u0005\u0002\u0000\n\n\r\r\u0002\u0000AZaz"+
"\u0001\u000009\u0002\u0000$$__\u0003\u0000\t\n\r\r \u01cd\u0000\u0001"+
"\u0001\u0000\u0000\u0000\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005"+
"\u0001\u0000\u0000\u0000\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001"+
"\u0000\u0000\u0000\u0000\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000"+
"\u0000\u0000\u0000\u000f\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000"+
"\u0000\u0000\u0000\u0013\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000"+
"\u0000\u0000\u0000\u0017\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000"+
"\u0000\u0000\u0000\u001b\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000"+
"\u0000\u0000\u0000\u001f\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000"+
"\u0000\u0000#\u0001\u0000\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000"+
"\'\u0001\u0000\u0000\u0000\u0000)\u0001\u0000\u0000\u0000\u0000+\u0001"+
"\u0000\u0000\u0000\u0000-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000"+
"\u0000\u00001\u0001\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u0000"+
"5\u0001\u0000\u0000\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001"+
"\u0000\u0000\u0000\u0000;\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000"+
"\u0000\u0000?\u0001\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000"+
"C\u0001\u0000\u0000\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001"+
"\u0000\u0000\u0000\u0000I\u0001\u0000\u0000\u0000\u0000K\u0001\u0000\u0000"+
"\u0000\u0000M\u0001\u0000\u0000\u0000\u0000O\u0001\u0000\u0000\u0000\u0000"+
"Q\u0001\u0000\u0000\u0000\u0000S\u0001\u0000\u0000\u0000\u0000U\u0001"+
"\u0000\u0000\u0000\u0000W\u0001\u0000\u0000\u0000\u0000Y\u0001\u0000\u0000"+
"\u0000\u0000[\u0001\u0000\u0000\u0000\u0000]\u0001\u0000\u0000\u0000\u0000"+
"_\u0001\u0000\u0000\u0000\u0000a\u0001\u0000\u0000\u0000\u0000c\u0001"+
"\u0000\u0000\u0000\u0000e\u0001\u0000\u0000\u0000\u0000m\u0001\u0000\u0000"+
"\u0000\u0000o\u0001\u0000\u0000\u0000\u0000q\u0001\u0000\u0000\u0000\u0000"+
"s\u0001\u0000\u0000\u0000\u0001u\u0001\u0000\u0000\u0000\u0003x\u0001"+
"\u0000\u0000\u0000\u0005{\u0001\u0000\u0000\u0000\u0007\u0080\u0001\u0000"+
"\u0000\u0000\t\u0088\u0001\u0000\u0000\u0000\u000b\u008d\u0001\u0000\u0000"+
"\u0000\r\u00b9\u0001\u0000\u0000\u0000\u000f\u00bb\u0001\u0000\u0000\u0000"+
"\u0011\u00e5\u0001\u0000\u0000\u0000\u0013\u00e9\u0001\u0000\u0000\u0000"+
"\u0015\u00f1\u0001\u0000\u0000\u0000\u0017\u00f5\u0001\u0000\u0000\u0000"+
"\u0019\u00f7\u0001\u0000\u0000\u0000\u001b\u00f9\u0001\u0000\u0000\u0000"+
"\u001d\u00fb\u0001\u0000\u0000\u0000\u001f\u00fd\u0001\u0000\u0000\u0000"+
"!\u00ff\u0001\u0000\u0000\u0000#\u0101\u0001\u0000\u0000\u0000%\u0103"+
"\u0001\u0000\u0000\u0000\'\u0105\u0001\u0000\u0000\u0000)\u0107\u0001"+
"\u0000\u0000\u0000+\u010a\u0001\u0000\u0000\u0000-\u010d\u0001\u0000\u0000"+
"\u0000/\u0110\u0001\u0000\u0000\u00001\u0113\u0001\u0000\u0000\u00003"+
"\u0115\u0001\u0000\u0000\u00005\u0118\u0001\u0000\u0000\u00007\u011b\u0001"+
"\u0000\u0000\u00009\u011d\u0001\u0000\u0000\u0000;\u011f\u0001\u0000\u0000"+
"\u0000=\u0121\u0001\u0000\u0000\u0000?\u0123\u0001\u0000\u0000\u0000A"+
"\u0125\u0001\u0000\u0000\u0000C\u0127\u0001\u0000\u0000\u0000E\u0129\u0001"+
"\u0000\u0000\u0000G\u012f\u0001\u0000\u0000\u0000I\u0134\u0001\u0000\u0000"+
"\u0000K\u013a\u0001\u0000\u0000\u0000M\u013d\u0001\u0000\u0000\u0000O"+
"\u0140\u0001\u0000\u0000\u0000Q\u0145\u0001\u0000\u0000\u0000S\u0149\u0001"+
"\u0000\u0000\u0000U\u0150\u0001\u0000\u0000\u0000W\u0154\u0001\u0000\u0000"+
"\u0000Y\u015b\u0001\u0000\u0000\u0000[\u0160\u0001\u0000\u0000\u0000]"+
"\u0168\u0001\u0000\u0000\u0000_\u016a\u0001\u0000\u0000\u0000a\u0174\u0001"+
"\u0000\u0000\u0000c\u0184\u0001\u0000\u0000\u0000e\u0186\u0001\u0000\u0000"+
"\u0000g\u018b\u0001\u0000\u0000\u0000i\u018d\u0001\u0000\u0000\u0000k"+
"\u0192\u0001\u0000\u0000\u0000m\u0194\u0001\u0000\u0000\u0000o\u019c\u0001"+
"\u0000\u0000\u0000q\u01a2\u0001\u0000\u0000\u0000s\u01ad\u0001\u0000\u0000"+
"\u0000uv\u0005+\u0000\u0000vw\u0005+\u0000\u0000w\u0002\u0001\u0000\u0000"+
"\u0000xy\u0005-\u0000\u0000yz\u0005-\u0000\u0000z\u0004\u0001\u0000\u0000"+
"\u0000{|\u0005v\u0000\u0000|}\u0005o\u0000\u0000}~\u0005i\u0000\u0000"+
"~\u007f\u0005d\u0000\u0000\u007f\u0006\u0001\u0000\u0000\u0000\u0080\u0081"+
"\u0005b\u0000\u0000\u0081\u0082\u0005o\u0000\u0000\u0082\u0083\u0005o"+
"\u0000\u0000\u0083\u0084\u0005l\u0000\u0000\u0084\u0085\u0005e\u0000\u0000"+
"\u0085\u0086\u0005a\u0000\u0000\u0086\u0087\u0005n\u0000\u0000\u0087\b"+
"\u0001\u0000\u0000\u0000\u0088\u0089\u0005c\u0000\u0000\u0089\u008a\u0005"+
"h\u0000\u0000\u008a\u008b\u0005a\u0000\u0000\u008b\u008c\u0005r\u0000"+
"\u0000\u008c\n\u0001\u0000\u0000\u0000\u008d\u008e\u0005i\u0000\u0000"+
"\u008e\u008f\u0005n\u0000\u0000\u008f\u0090\u0005t\u0000\u0000\u0090\f"+
"\u0001\u0000\u0000\u0000\u0091\u0092\u0005p\u0000\u0000\u0092\u0093\u0005"+
"u\u0000\u0000\u0093\u0094\u0005b\u0000\u0000\u0094\u0095\u0005l\u0000"+
"\u0000\u0095\u0096\u0005i\u0000\u0000\u0096\u00ba\u0005c\u0000\u0000\u0097"+
"\u0098\u0005p\u0000\u0000\u0098\u0099\u0005r\u0000\u0000\u0099\u009a\u0005"+
"i\u0000\u0000\u009a\u009b\u0005v\u0000\u0000\u009b\u009c\u0005a\u0000"+
"\u0000\u009c\u009d\u0005t\u0000\u0000\u009d\u00ba\u0005e\u0000\u0000\u009e"+
"\u009f\u0005p\u0000\u0000\u009f\u00a0\u0005u\u0000\u0000\u00a0\u00a1\u0005"+
"b\u0000\u0000\u00a1\u00a2\u0005l\u0000\u0000\u00a2\u00a3\u0005i\u0000"+
"\u0000\u00a3\u00a4\u0005c\u0000\u0000\u00a4\u00a5\u0005 \u0000\u0000\u00a5"+
"\u00a6\u0005s\u0000\u0000\u00a6\u00a7\u0005t\u0000\u0000\u00a7\u00a8\u0005"+
"a\u0000\u0000\u00a8\u00a9\u0005t\u0000\u0000\u00a9\u00aa\u0005i\u0000"+
"\u0000\u00aa\u00ba\u0005c\u0000\u0000\u00ab\u00ac\u0005p\u0000\u0000\u00ac"+
"\u00ad\u0005r\u0000\u0000\u00ad\u00ae\u0005i\u0000\u0000\u00ae\u00af\u0005"+
"v\u0000\u0000\u00af\u00b0\u0005a\u0000\u0000\u00b0\u00b1\u0005t\u0000"+
"\u0000\u00b1\u00b2\u0005e\u0000\u0000\u00b2\u00b3\u0005 \u0000\u0000\u00b3"+
"\u00b4\u0005s\u0000\u0000\u00b4\u00b5\u0005t\u0000\u0000\u00b5\u00b6\u0005"+
"a\u0000\u0000\u00b6\u00b7\u0005t\u0000\u0000\u00b7\u00b8\u0005i\u0000"+
"\u0000\u00b8\u00ba\u0005c\u0000\u0000\u00b9\u0091\u0001\u0000\u0000\u0000"+
"\u00b9\u0097\u0001\u0000\u0000\u0000\u00b9\u009e\u0001\u0000\u0000\u0000"+
"\u00b9\u00ab\u0001\u0000\u0000\u0000\u00ba\u000e\u0001\u0000\u0000\u0000"+
"\u00bb\u00bc\u0005p\u0000\u0000\u00bc\u00bd\u0005u\u0000\u0000\u00bd\u00be"+
"\u0005b\u0000\u0000\u00be\u00bf\u0005l\u0000\u0000\u00bf\u00c0\u0005i"+
"\u0000\u0000\u00c0\u00c1\u0005c\u0000\u0000\u00c1\u00c2\u0005 \u0000\u0000"+
"\u00c2\u00c3\u0005s\u0000\u0000\u00c3\u00c4\u0005t\u0000\u0000\u00c4\u00c5"+
"\u0005a\u0000\u0000\u00c5\u00c6\u0005t\u0000\u0000\u00c6\u00c7\u0005i"+
"\u0000\u0000\u00c7\u00c8\u0005c\u0000\u0000\u00c8\u00c9\u0005 \u0000\u0000"+
"\u00c9\u00ca\u0005v\u0000\u0000\u00ca\u00cb\u0005o\u0000\u0000\u00cb\u00cc"+
"\u0005i\u0000\u0000\u00cc\u00cd\u0005d\u0000\u0000\u00cd\u00ce\u0005 "+
"\u0000\u0000\u00ce\u00cf\u0005m\u0000\u0000\u00cf\u00d0\u0005a\u0000\u0000"+
"\u00d0\u00d1\u0005i\u0000\u0000\u00d1\u00d2\u0005n\u0000\u0000\u00d2\u00d3"+
"\u0005(\u0000\u0000\u00d3\u00d4\u0005S\u0000\u0000\u00d4\u00d5\u0005t"+
"\u0000\u0000\u00d5\u00d6\u0005r\u0000\u0000\u00d6\u00d7\u0005i\u0000\u0000"+
"\u00d7\u00d8\u0005n\u0000\u0000\u00d8\u00d9\u0005g\u0000\u0000\u00d9\u00da"+
"\u0005[\u0000\u0000\u00da\u00db\u0005]\u0000\u0000\u00db\u00dc\u0005 "+
"\u0000\u0000\u00dc\u00dd\u0005a\u0000\u0000\u00dd\u00de\u0005r\u0000\u0000"+
"\u00de\u00df\u0005g\u0000\u0000\u00df\u00e0\u0005s\u0000\u0000\u00e0\u00e1"+
"\u0005)\u0000\u0000\u00e1\u0010\u0001\u0000\u0000\u0000\u00e2\u00e6\u0003"+
"\u001f\u000f\u0000\u00e3\u00e6\u0003#\u0011\u0000\u00e4\u00e6\u0003!\u0010"+
"\u0000\u00e5\u00e2\u0001\u0000\u0000\u0000\u00e5\u00e3\u0001\u0000\u0000"+
"\u0000\u00e5\u00e4\u0001\u0000\u0000\u0000\u00e6\u0012\u0001\u0000\u0000"+
"\u0000\u00e7\u00ea\u0003\u001b\r\u0000\u00e8\u00ea\u0003\u001d\u000e\u0000"+
"\u00e9\u00e7\u0001\u0000\u0000\u0000\u00e9\u00e8\u0001\u0000\u0000\u0000"+
"\u00ea\u0014\u0001\u0000\u0000\u0000\u00eb\u00f2\u0003%\u0012\u0000\u00ec"+
"\u00f2\u0003\'\u0013\u0000\u00ed\u00f2\u0003)\u0014\u0000\u00ee\u00f2"+
"\u0003+\u0015\u0000\u00ef\u00f2\u0003-\u0016\u0000\u00f0\u00f2\u0003/"+
"\u0017\u0000\u00f1\u00eb\u0001\u0000\u0000\u0000\u00f1\u00ec\u0001\u0000"+
"\u0000\u0000\u00f1\u00ed\u0001\u0000\u0000\u0000\u00f1\u00ee\u0001\u0000"+
"\u0000\u0000\u00f1\u00ef\u0001\u0000\u0000\u0000\u00f1\u00f0\u0001\u0000"+
"\u0000\u0000\u00f2\u0016\u0001\u0000\u0000\u0000\u00f3\u00f6\u00033\u0019"+
"\u0000\u00f4\u00f6\u00035\u001a\u0000\u00f5\u00f3\u0001\u0000\u0000\u0000"+
"\u00f5\u00f4\u0001\u0000\u0000\u0000\u00f6\u0018\u0001\u0000\u0000\u0000"+
"\u00f7\u00f8\u0005=\u0000\u0000\u00f8\u001a\u0001\u0000\u0000\u0000\u00f9"+
"\u00fa\u0005+\u0000\u0000\u00fa\u001c\u0001\u0000\u0000\u0000\u00fb\u00fc"+
"\u0005-\u0000\u0000\u00fc\u001e\u0001\u0000\u0000\u0000\u00fd\u00fe\u0005"+
"*\u0000\u0000\u00fe \u0001\u0000\u0000\u0000\u00ff\u0100\u0005%\u0000"+
"\u0000\u0100\"\u0001\u0000\u0000\u0000\u0101\u0102\u0005/\u0000\u0000"+
"\u0102$\u0001\u0000\u0000\u0000\u0103\u0104\u0005>\u0000\u0000\u0104&"+
"\u0001\u0000\u0000\u0000\u0105\u0106\u0005<\u0000\u0000\u0106(\u0001\u0000"+
"\u0000\u0000\u0107\u0108\u0005>\u0000\u0000\u0108\u0109\u0005=\u0000\u0000"+
"\u0109*\u0001\u0000\u0000\u0000\u010a\u010b\u0005<\u0000\u0000\u010b\u010c"+
"\u0005=\u0000\u0000\u010c,\u0001\u0000\u0000\u0000\u010d\u010e\u0005="+
"\u0000\u0000\u010e\u010f\u0005=\u0000\u0000\u010f.\u0001\u0000\u0000\u0000"+
"\u0110\u0111\u0005!\u0000\u0000\u0111\u0112\u0005=\u0000\u0000\u01120"+
"\u0001\u0000\u0000\u0000\u0113\u0114\u0005!\u0000\u0000\u01142\u0001\u0000"+
"\u0000\u0000\u0115\u0116\u0005&\u0000\u0000\u0116\u0117\u0005&\u0000\u0000"+
"\u01174\u0001\u0000\u0000\u0000\u0118\u0119\u0005|\u0000\u0000\u0119\u011a"+
"\u0005|\u0000\u0000\u011a6\u0001\u0000\u0000\u0000\u011b\u011c\u0005."+
"\u0000\u0000\u011c8\u0001\u0000\u0000\u0000\u011d\u011e\u0005(\u0000\u0000"+
"\u011e:\u0001\u0000\u0000\u0000\u011f\u0120\u0005)\u0000\u0000\u0120<"+
"\u0001\u0000\u0000\u0000\u0121\u0122\u0005{\u0000\u0000\u0122>\u0001\u0000"+
"\u0000\u0000\u0123\u0124\u0005}\u0000\u0000\u0124@\u0001\u0000\u0000\u0000"+
"\u0125\u0126\u0005;\u0000\u0000\u0126B\u0001\u0000\u0000\u0000\u0127\u0128"+
"\u0005,\u0000\u0000\u0128D\u0001\u0000\u0000\u0000\u0129\u012a\u0005c"+
"\u0000\u0000\u012a\u012b\u0005l\u0000\u0000\u012b\u012c\u0005a\u0000\u0000"+
"\u012c\u012d\u0005s\u0000\u0000\u012d\u012e\u0005s\u0000\u0000\u012eF"+
"\u0001\u0000\u0000\u0000\u012f\u0130\u0005t\u0000\u0000\u0130\u0131\u0005"+
"h\u0000\u0000\u0131\u0132\u0005i\u0000\u0000\u0132\u0133\u0005s\u0000"+
"\u0000\u0133H\u0001\u0000\u0000\u0000\u0134\u0135\u0005w\u0000\u0000\u0135"+
"\u0136\u0005h\u0000\u0000\u0136\u0137\u0005i\u0000\u0000\u0137\u0138\u0005"+
"l\u0000\u0000\u0138\u0139\u0005e\u0000\u0000\u0139J\u0001\u0000\u0000"+
"\u0000\u013a\u013b\u0005d\u0000\u0000\u013b\u013c\u0005o\u0000\u0000\u013c"+
"L\u0001\u0000\u0000\u0000\u013d\u013e\u0005i\u0000\u0000\u013e\u013f\u0005"+
"f\u0000\u0000\u013fN\u0001\u0000\u0000\u0000\u0140\u0141\u0005e\u0000"+
"\u0000\u0141\u0142\u0005l\u0000\u0000\u0142\u0143\u0005s\u0000\u0000\u0143"+
"\u0144\u0005e\u0000\u0000\u0144P\u0001\u0000\u0000\u0000\u0145\u0146\u0005"+
"f\u0000\u0000\u0146\u0147\u0005o\u0000\u0000\u0147\u0148\u0005r\u0000"+
"\u0000\u0148R\u0001\u0000\u0000\u0000\u0149\u014a\u0005r\u0000\u0000\u014a"+
"\u014b\u0005e\u0000\u0000\u014b\u014c\u0005t\u0000\u0000\u014c\u014d\u0005"+
"u\u0000\u0000\u014d\u014e\u0005r\u0000\u0000\u014e\u014f\u0005n\u0000"+
"\u0000\u014fT\u0001\u0000\u0000\u0000\u0150\u0151\u0005n\u0000\u0000\u0151"+
"\u0152\u0005e\u0000\u0000\u0152\u0153\u0005w\u0000\u0000\u0153V\u0001"+
"\u0000\u0000\u0000\u0154\u0155\u0005s\u0000\u0000\u0155\u0156\u0005w\u0000"+
"\u0000\u0156\u0157\u0005i\u0000\u0000\u0157\u0158\u0005t\u0000\u0000\u0158"+
"\u0159\u0005c\u0000\u0000\u0159\u015a\u0005h\u0000\u0000\u015aX\u0001"+
"\u0000\u0000\u0000\u015b\u015c\u0005c\u0000\u0000\u015c\u015d\u0005a\u0000"+
"\u0000\u015d\u015e\u0005s\u0000\u0000\u015e\u015f\u0005e\u0000\u0000\u015f"+
"Z\u0001\u0000\u0000\u0000\u0160\u0161\u0005d\u0000\u0000\u0161\u0162\u0005"+
"e\u0000\u0000\u0162\u0163\u0005f\u0000\u0000\u0163\u0164\u0005a\u0000"+
"\u0000\u0164\u0165\u0005u\u0000\u0000\u0165\u0166\u0005l\u0000\u0000\u0166"+
"\u0167\u0005t\u0000\u0000\u0167\\\u0001\u0000\u0000\u0000\u0168\u0169"+
"\u0005:\u0000\u0000\u0169^\u0001\u0000\u0000\u0000\u016a\u016e\u0005\'"+
"\u0000\u0000\u016b\u016d\b\u0000\u0000\u0000\u016c\u016b\u0001\u0000\u0000"+
"\u0000\u016d\u0170\u0001\u0000\u0000\u0000\u016e\u016c\u0001\u0000\u0000"+
"\u0000\u016e\u016f\u0001\u0000\u0000\u0000\u016f\u0171\u0001\u0000\u0000"+
"\u0000\u0170\u016e\u0001\u0000\u0000\u0000\u0171\u0172\u0005\'\u0000\u0000"+
"\u0172`\u0001\u0000\u0000\u0000\u0173\u0175\u0003\u001d\u000e\u0000\u0174"+
"\u0173\u0001\u0000\u0000\u0000\u0174\u0175\u0001\u0000\u0000\u0000\u0175"+
"\u0177\u0001\u0000\u0000\u0000\u0176\u0178\u0003i4\u0000\u0177\u0176\u0001"+
"\u0000\u0000\u0000\u0178\u0179\u0001\u0000\u0000\u0000\u0179\u0177\u0001"+
"\u0000\u0000\u0000\u0179\u017a\u0001\u0000\u0000\u0000\u017ab\u0001\u0000"+
"\u0000\u0000\u017b\u017c\u0005t\u0000\u0000\u017c\u017d\u0005r\u0000\u0000"+
"\u017d\u017e\u0005u\u0000\u0000\u017e\u0185\u0005e\u0000\u0000\u017f\u0180"+
"\u0005f\u0000\u0000\u0180\u0181\u0005a\u0000\u0000\u0181\u0182\u0005l"+
"\u0000\u0000\u0182\u0183\u0005s\u0000\u0000\u0183\u0185\u0005e\u0000\u0000"+
"\u0184\u017b\u0001\u0000\u0000\u0000\u0184\u017f\u0001\u0000\u0000\u0000"+
"\u0185d\u0001\u0000\u0000\u0000\u0186\u0187\u0005n\u0000\u0000\u0187\u0188"+
"\u0005u\u0000\u0000\u0188\u0189\u0005l\u0000\u0000\u0189\u018a\u0005l"+
"\u0000\u0000\u018af\u0001\u0000\u0000\u0000\u018b\u018c\u0007\u0001\u0000"+
"\u0000\u018ch\u0001\u0000\u0000\u0000\u018d\u018e\u0007\u0002\u0000\u0000"+
"\u018ej\u0001\u0000\u0000\u0000\u018f\u0193\u0003g3\u0000\u0190\u0193"+
"\u0003i4\u0000\u0191\u0193\u0007\u0003\u0000\u0000\u0192\u018f\u0001\u0000"+
"\u0000\u0000\u0192\u0190\u0001\u0000\u0000\u0000\u0192\u0191\u0001\u0000"+
"\u0000\u0000\u0193l\u0001\u0000\u0000\u0000\u0194\u0198\u0003g3\u0000"+
"\u0195\u0197\u0003k5\u0000\u0196\u0195\u0001\u0000\u0000\u0000\u0197\u019a"+
"\u0001\u0000\u0000\u0000\u0198\u0196\u0001\u0000\u0000\u0000\u0198\u0199"+
"\u0001\u0000\u0000\u0000\u0199n\u0001\u0000\u0000\u0000\u019a\u0198\u0001"+
"\u0000\u0000\u0000\u019b\u019d\u0007\u0004\u0000\u0000\u019c\u019b\u0001"+
"\u0000\u0000\u0000\u019d\u019e\u0001\u0000\u0000\u0000\u019e\u019c\u0001"+
"\u0000\u0000\u0000\u019e\u019f\u0001\u0000\u0000\u0000\u019f\u01a0\u0001"+
"\u0000\u0000\u0000\u01a0\u01a1\u00067\u0000\u0000\u01a1p\u0001\u0000\u0000"+
"\u0000\u01a2\u01a3\u0005/\u0000\u0000\u01a3\u01a4\u0005/\u0000\u0000\u01a4"+
"\u01a8\u0001\u0000\u0000\u0000\u01a5\u01a7\b\u0000\u0000\u0000\u01a6\u01a5"+
"\u0001\u0000\u0000\u0000\u01a7\u01aa\u0001\u0000\u0000\u0000\u01a8\u01a6"+
"\u0001\u0000\u0000\u0000\u01a8\u01a9\u0001\u0000\u0000\u0000\u01a9\u01ab"+
"\u0001\u0000\u0000\u0000\u01aa\u01a8\u0001\u0000\u0000\u0000\u01ab\u01ac"+
"\u00068\u0000\u0000\u01acr\u0001\u0000\u0000\u0000\u01ad\u01ae\u0005/"+
"\u0000\u0000\u01ae\u01af\u0005*\u0000\u0000\u01af\u01b3\u0001\u0000\u0000"+
"\u0000\u01b0\u01b2\t\u0000\u0000\u0000\u01b1\u01b0\u0001\u0000\u0000\u0000"+
"\u01b2\u01b5\u0001\u0000\u0000\u0000\u01b3\u01b4\u0001\u0000\u0000\u0000"+
"\u01b3\u01b1\u0001\u0000\u0000\u0000\u01b4\u01b6\u0001\u0000\u0000\u0000"+
"\u01b5\u01b3\u0001\u0000\u0000\u0000\u01b6\u01b7\u0005*\u0000\u0000\u01b7"+
"\u01b8\u0005/\u0000\u0000\u01b8\u01b9\u0001\u0000\u0000\u0000\u01b9\u01ba"+
"\u00069\u0000\u0000\u01bat\u0001\u0000\u0000\u0000\u000f\u0000\u00b9\u00e5"+
"\u00e9\u00f1\u00f5\u016e\u0174\u0179\u0184\u0192\u0198\u019e\u01a8\u01b3"+
"\u0001\u0006\u0000\u0000";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {

View File

@@ -1,73 +1,98 @@
T__0=1
T__1=2
T__2=3
T__3=4
T__4=5
T__5=6
T__6=7
T__7=8
T__8=9
T__9=10
T__10=11
T__11=12
T__12=13
T__13=14
T__14=15
T__15=16
T__16=17
T__17=18
T__18=19
T__19=20
T__20=21
T__21=22
T__22=23
T__23=24
T__24=25
T__25=26
T__26=27
T__27=28
T__28=29
T__29=30
T__30=31
T__31=32
T__32=33
T__33=34
T__34=35
INTEGERLITERAL=36
IDENTIFIER=37
WS=38
'class'=1
'{'=2
'}'=3
';'=4
'static'=5
'('=6
')'=7
','=8
'int'=9
'boolean'=10
'char'=11
'public'=12
'private'=13
'='=14
'if'=15
'else'=16
'while'=17
'return'=18
'&&'=19
'||'=20
'=='=21
'!='=22
'<'=23
'<='=24
'>'=25
'>='=26
'+'=27
'-'=28
'*'=29
'/'=30
'%'=31
'!'=32
'true'=33
'false'=34
'\''=35
Void=3
Boolean=4
Char=5
Int=6
AccessModifier=7
MainMethodDeclaration=8
DotOperator=9
LineOperator=10
ComparisonOperator=11
LogicalOperator=12
Assign=13
Plus=14
Minus=15
Mult=16
Modulo=17
Div=18
Greater=19
Less=20
GreaterEqual=21
LessEqual=22
Equal=23
NotEqual=24
Not=25
And=26
Or=27
Dot=28
OpenRoundBracket=29
ClosedRoundBracket=30
OpenCurlyBracket=31
ClosedCurlyBracket=32
Semicolon=33
Comma=34
Class=35
This=36
While=37
Do=38
If=39
Else=40
For=41
Return=42
New=43
Switch=44
Case=45
Default=46
Colon=47
CharValue=48
IntValue=49
BooleanValue=50
NullValue=51
Identifier=52
WS=53
InlineComment=54
MultilineComment=55
'++'=1
'--'=2
'void'=3
'boolean'=4
'char'=5
'int'=6
'public static void main(String[] args)'=8
'='=13
'+'=14
'-'=15
'*'=16
'%'=17
'/'=18
'>'=19
'<'=20
'>='=21
'<='=22
'=='=23
'!='=24
'!'=25
'&&'=26
'||'=27
'.'=28
'('=29
')'=30
'{'=31
'}'=32
';'=33
','=34
'class'=35
'this'=36
'while'=37
'do'=38
'if'=39
'else'=40
'for'=41
'return'=42
'new'=43
'switch'=44
'case'=45
'default'=46
':'=47
'null'=51

View File

@@ -1,4 +1,4 @@
// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
// Generated from C:/Users/Maxi/Documents/DHBW/Compilerbau/NichtHaskell2.0/src/main/java/parser/grammar/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.ParseTreeListener;
@@ -37,6 +37,16 @@ public interface SimpleJavaListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#constructorDeclaration}.
* @param ctx the parse tree
*/
void enterConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#constructorDeclaration}.
* @param ctx the parse tree
*/
void exitConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#fieldDeclaration}.
* @param ctx the parse tree
@@ -78,25 +88,15 @@ public interface SimpleJavaListener extends ParseTreeListener {
*/
void exitParameter(SimpleJavaParser.ParameterContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#type}.
* Enter a parse tree produced by {@link SimpleJavaParser#argumentList}.
* @param ctx the parse tree
*/
void enterType(SimpleJavaParser.TypeContext ctx);
void enterArgumentList(SimpleJavaParser.ArgumentListContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#type}.
* Exit a parse tree produced by {@link SimpleJavaParser#argumentList}.
* @param ctx the parse tree
*/
void exitType(SimpleJavaParser.TypeContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#accessType}.
* @param ctx the parse tree
*/
void enterAccessType(SimpleJavaParser.AccessTypeContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#accessType}.
* @param ctx the parse tree
*/
void exitAccessType(SimpleJavaParser.AccessTypeContext ctx);
void exitArgumentList(SimpleJavaParser.ArgumentListContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#statement}.
* @param ctx the parse tree
@@ -108,45 +108,15 @@ public interface SimpleJavaListener extends ParseTreeListener {
*/
void exitStatement(SimpleJavaParser.StatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#variableDeclarationStatement}.
* Enter a parse tree produced by {@link SimpleJavaParser#blockStatement}.
* @param ctx the parse tree
*/
void enterVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx);
void enterBlockStatement(SimpleJavaParser.BlockStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#variableDeclarationStatement}.
* Exit a parse tree produced by {@link SimpleJavaParser#blockStatement}.
* @param ctx the parse tree
*/
void exitVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#assignmentStatement}.
* @param ctx the parse tree
*/
void enterAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#assignmentStatement}.
* @param ctx the parse tree
*/
void exitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#ifStatement}.
* @param ctx the parse tree
*/
void enterIfStatement(SimpleJavaParser.IfStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#ifStatement}.
* @param ctx the parse tree
*/
void exitIfStatement(SimpleJavaParser.IfStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#whileStatement}.
* @param ctx the parse tree
*/
void enterWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#whileStatement}.
* @param ctx the parse tree
*/
void exitWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
void exitBlockStatement(SimpleJavaParser.BlockStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#returnStatement}.
* @param ctx the parse tree
@@ -158,15 +128,145 @@ public interface SimpleJavaListener extends ParseTreeListener {
*/
void exitReturnStatement(SimpleJavaParser.ReturnStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#block}.
* Enter a parse tree produced by {@link SimpleJavaParser#localVariableDeclaration}.
* @param ctx the parse tree
*/
void enterBlock(SimpleJavaParser.BlockContext ctx);
void enterLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#block}.
* Exit a parse tree produced by {@link SimpleJavaParser#localVariableDeclaration}.
* @param ctx the parse tree
*/
void exitBlock(SimpleJavaParser.BlockContext ctx);
void exitLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#whileStatement}.
* @param ctx the parse tree
*/
void enterWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#whileStatement}.
* @param ctx the parse tree
*/
void exitWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#doWhileStatement}.
* @param ctx the parse tree
*/
void enterDoWhileStatement(SimpleJavaParser.DoWhileStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#doWhileStatement}.
* @param ctx the parse tree
*/
void exitDoWhileStatement(SimpleJavaParser.DoWhileStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#forStatement}.
* @param ctx the parse tree
*/
void enterForStatement(SimpleJavaParser.ForStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#forStatement}.
* @param ctx the parse tree
*/
void exitForStatement(SimpleJavaParser.ForStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#ifElseStatement}.
* @param ctx the parse tree
*/
void enterIfElseStatement(SimpleJavaParser.IfElseStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#ifElseStatement}.
* @param ctx the parse tree
*/
void exitIfElseStatement(SimpleJavaParser.IfElseStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#ifStatement}.
* @param ctx the parse tree
*/
void enterIfStatement(SimpleJavaParser.IfStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#ifStatement}.
* @param ctx the parse tree
*/
void exitIfStatement(SimpleJavaParser.IfStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#elseIfStatement}.
* @param ctx the parse tree
*/
void enterElseIfStatement(SimpleJavaParser.ElseIfStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#elseIfStatement}.
* @param ctx the parse tree
*/
void exitElseIfStatement(SimpleJavaParser.ElseIfStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#elseStatement}.
* @param ctx the parse tree
*/
void enterElseStatement(SimpleJavaParser.ElseStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#elseStatement}.
* @param ctx the parse tree
*/
void exitElseStatement(SimpleJavaParser.ElseStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#switchStatement}.
* @param ctx the parse tree
*/
void enterSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#switchStatement}.
* @param ctx the parse tree
*/
void exitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#caseStatement}.
* @param ctx the parse tree
*/
void enterCaseStatement(SimpleJavaParser.CaseStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#caseStatement}.
* @param ctx the parse tree
*/
void exitCaseStatement(SimpleJavaParser.CaseStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#defaultStatement}.
* @param ctx the parse tree
*/
void enterDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#defaultStatement}.
* @param ctx the parse tree
*/
void exitDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#statementExpression}.
* @param ctx the parse tree
*/
void enterStatementExpression(SimpleJavaParser.StatementExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#statementExpression}.
* @param ctx the parse tree
*/
void exitStatementExpression(SimpleJavaParser.StatementExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#assign}.
* @param ctx the parse tree
*/
void enterAssign(SimpleJavaParser.AssignContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#assign}.
* @param ctx the parse tree
*/
void exitAssign(SimpleJavaParser.AssignContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#newDeclaration}.
* @param ctx the parse tree
*/
void enterNewDeclaration(SimpleJavaParser.NewDeclarationContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#newDeclaration}.
* @param ctx the parse tree
*/
void exitNewDeclaration(SimpleJavaParser.NewDeclarationContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#expression}.
* @param ctx the parse tree
@@ -178,33 +278,223 @@ public interface SimpleJavaListener extends ParseTreeListener {
*/
void exitExpression(SimpleJavaParser.ExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#literal}.
* Enter a parse tree produced by {@link SimpleJavaParser#unaryExpression}.
* @param ctx the parse tree
*/
void enterLiteral(SimpleJavaParser.LiteralContext ctx);
void enterUnaryExpression(SimpleJavaParser.UnaryExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#literal}.
* Exit a parse tree produced by {@link SimpleJavaParser#unaryExpression}.
* @param ctx the parse tree
*/
void exitLiteral(SimpleJavaParser.LiteralContext ctx);
void exitUnaryExpression(SimpleJavaParser.UnaryExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#booleanLiteral}.
* Enter a parse tree produced by {@link SimpleJavaParser#notExpression}.
* @param ctx the parse tree
*/
void enterBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx);
void enterNotExpression(SimpleJavaParser.NotExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#booleanLiteral}.
* Exit a parse tree produced by {@link SimpleJavaParser#notExpression}.
* @param ctx the parse tree
*/
void exitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx);
void exitNotExpression(SimpleJavaParser.NotExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#charLiteral}.
* Enter a parse tree produced by {@link SimpleJavaParser#crementExpression}.
* @param ctx the parse tree
*/
void enterCharLiteral(SimpleJavaParser.CharLiteralContext ctx);
void enterCrementExpression(SimpleJavaParser.CrementExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#charLiteral}.
* Exit a parse tree produced by {@link SimpleJavaParser#crementExpression}.
* @param ctx the parse tree
*/
void exitCharLiteral(SimpleJavaParser.CharLiteralContext ctx);
void exitCrementExpression(SimpleJavaParser.CrementExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#incrementExpression}.
* @param ctx the parse tree
*/
void enterIncrementExpression(SimpleJavaParser.IncrementExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#incrementExpression}.
* @param ctx the parse tree
*/
void exitIncrementExpression(SimpleJavaParser.IncrementExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#prefixIncrementExpression}.
* @param ctx the parse tree
*/
void enterPrefixIncrementExpression(SimpleJavaParser.PrefixIncrementExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#prefixIncrementExpression}.
* @param ctx the parse tree
*/
void exitPrefixIncrementExpression(SimpleJavaParser.PrefixIncrementExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#suffixIncrementExpression}.
* @param ctx the parse tree
*/
void enterSuffixIncrementExpression(SimpleJavaParser.SuffixIncrementExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#suffixIncrementExpression}.
* @param ctx the parse tree
*/
void exitSuffixIncrementExpression(SimpleJavaParser.SuffixIncrementExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#decrementExpression}.
* @param ctx the parse tree
*/
void enterDecrementExpression(SimpleJavaParser.DecrementExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#decrementExpression}.
* @param ctx the parse tree
*/
void exitDecrementExpression(SimpleJavaParser.DecrementExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#prefixDecrementExpression}.
* @param ctx the parse tree
*/
void enterPrefixDecrementExpression(SimpleJavaParser.PrefixDecrementExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#prefixDecrementExpression}.
* @param ctx the parse tree
*/
void exitPrefixDecrementExpression(SimpleJavaParser.PrefixDecrementExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#suffixDecrementExpression}.
* @param ctx the parse tree
*/
void enterSuffixDecrementExpression(SimpleJavaParser.SuffixDecrementExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#suffixDecrementExpression}.
* @param ctx the parse tree
*/
void exitSuffixDecrementExpression(SimpleJavaParser.SuffixDecrementExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#assignableExpression}.
* @param ctx the parse tree
*/
void enterAssignableExpression(SimpleJavaParser.AssignableExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#assignableExpression}.
* @param ctx the parse tree
*/
void exitAssignableExpression(SimpleJavaParser.AssignableExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#memberAccess}.
* @param ctx the parse tree
*/
void enterMemberAccess(SimpleJavaParser.MemberAccessContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#memberAccess}.
* @param ctx the parse tree
*/
void exitMemberAccess(SimpleJavaParser.MemberAccessContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#binaryExpression}.
* @param ctx the parse tree
*/
void enterBinaryExpression(SimpleJavaParser.BinaryExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#binaryExpression}.
* @param ctx the parse tree
*/
void exitBinaryExpression(SimpleJavaParser.BinaryExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#calculationExpression}.
* @param ctx the parse tree
*/
void enterCalculationExpression(SimpleJavaParser.CalculationExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#calculationExpression}.
* @param ctx the parse tree
*/
void exitCalculationExpression(SimpleJavaParser.CalculationExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#dotExpression}.
* @param ctx the parse tree
*/
void enterDotExpression(SimpleJavaParser.DotExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#dotExpression}.
* @param ctx the parse tree
*/
void exitDotExpression(SimpleJavaParser.DotExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#dotSubtractionExpression}.
* @param ctx the parse tree
*/
void enterDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#dotSubtractionExpression}.
* @param ctx the parse tree
*/
void exitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#nonCalculationExpression}.
* @param ctx the parse tree
*/
void enterNonCalculationExpression(SimpleJavaParser.NonCalculationExpressionContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#nonCalculationExpression}.
* @param ctx the parse tree
*/
void exitNonCalculationExpression(SimpleJavaParser.NonCalculationExpressionContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#methodCall}.
* @param ctx the parse tree
*/
void enterMethodCall(SimpleJavaParser.MethodCallContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#methodCall}.
* @param ctx the parse tree
*/
void exitMethodCall(SimpleJavaParser.MethodCallContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#target}.
* @param ctx the parse tree
*/
void enterTarget(SimpleJavaParser.TargetContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#target}.
* @param ctx the parse tree
*/
void exitTarget(SimpleJavaParser.TargetContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#chainedMethod}.
* @param ctx the parse tree
*/
void enterChainedMethod(SimpleJavaParser.ChainedMethodContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#chainedMethod}.
* @param ctx the parse tree
*/
void exitChainedMethod(SimpleJavaParser.ChainedMethodContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#type}.
* @param ctx the parse tree
*/
void enterType(SimpleJavaParser.TypeContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#type}.
* @param ctx the parse tree
*/
void exitType(SimpleJavaParser.TypeContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#value}.
* @param ctx the parse tree
*/
void enterValue(SimpleJavaParser.ValueContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#value}.
* @param ctx the parse tree
*/
void exitValue(SimpleJavaParser.ValueContext ctx);
/**
* Enter a parse tree produced by {@link SimpleJavaParser#nonCalculationOperator}.
* @param ctx the parse tree
*/
void enterNonCalculationOperator(SimpleJavaParser.NonCalculationOperatorContext ctx);
/**
* Exit a parse tree produced by {@link SimpleJavaParser#nonCalculationOperator}.
* @param ctx the parse tree
*/
void exitNonCalculationOperator(SimpleJavaParser.NonCalculationOperatorContext ctx);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
// Generated from C:/Users/ARB00072/Desktop/DHBW/4. Semester/Compilerbau/Endprojekt/NichtHaskell2.0/src/main/java/parser/SimpleJava.g4 by ANTLR 4.13.1
// Generated from C:/Users/Maxi/Documents/DHBW/Compilerbau/NichtHaskell2.0/src/main/java/parser/grammar/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
@@ -28,6 +28,12 @@ public interface SimpleJavaVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitMemberDeclaration(SimpleJavaParser.MemberDeclarationContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#constructorDeclaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstructorDeclaration(SimpleJavaParser.ConstructorDeclarationContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#fieldDeclaration}.
* @param ctx the parse tree
@@ -53,17 +59,11 @@ public interface SimpleJavaVisitor<T> extends ParseTreeVisitor<T> {
*/
T visitParameter(SimpleJavaParser.ParameterContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#type}.
* Visit a parse tree produced by {@link SimpleJavaParser#argumentList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType(SimpleJavaParser.TypeContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#accessType}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAccessType(SimpleJavaParser.AccessTypeContext ctx);
T visitArgumentList(SimpleJavaParser.ArgumentListContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#statement}.
* @param ctx the parse tree
@@ -71,29 +71,11 @@ public interface SimpleJavaVisitor<T> extends ParseTreeVisitor<T> {
*/
T visitStatement(SimpleJavaParser.StatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#variableDeclarationStatement}.
* Visit a parse tree produced by {@link SimpleJavaParser#blockStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVariableDeclarationStatement(SimpleJavaParser.VariableDeclarationStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#assignmentStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAssignmentStatement(SimpleJavaParser.AssignmentStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#ifStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfStatement(SimpleJavaParser.IfStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#whileStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
T visitBlockStatement(SimpleJavaParser.BlockStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#returnStatement}.
* @param ctx the parse tree
@@ -101,11 +83,89 @@ public interface SimpleJavaVisitor<T> extends ParseTreeVisitor<T> {
*/
T visitReturnStatement(SimpleJavaParser.ReturnStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#block}.
* Visit a parse tree produced by {@link SimpleJavaParser#localVariableDeclaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBlock(SimpleJavaParser.BlockContext ctx);
T visitLocalVariableDeclaration(SimpleJavaParser.LocalVariableDeclarationContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#whileStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWhileStatement(SimpleJavaParser.WhileStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#doWhileStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDoWhileStatement(SimpleJavaParser.DoWhileStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#forStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitForStatement(SimpleJavaParser.ForStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#ifElseStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfElseStatement(SimpleJavaParser.IfElseStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#ifStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIfStatement(SimpleJavaParser.IfStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#elseIfStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitElseIfStatement(SimpleJavaParser.ElseIfStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#elseStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitElseStatement(SimpleJavaParser.ElseStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#switchStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSwitchStatement(SimpleJavaParser.SwitchStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#caseStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCaseStatement(SimpleJavaParser.CaseStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#defaultStatement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefaultStatement(SimpleJavaParser.DefaultStatementContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#statementExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStatementExpression(SimpleJavaParser.StatementExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#assign}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAssign(SimpleJavaParser.AssignContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#newDeclaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNewDeclaration(SimpleJavaParser.NewDeclarationContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#expression}.
* @param ctx the parse tree
@@ -113,21 +173,135 @@ public interface SimpleJavaVisitor<T> extends ParseTreeVisitor<T> {
*/
T visitExpression(SimpleJavaParser.ExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#literal}.
* Visit a parse tree produced by {@link SimpleJavaParser#unaryExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLiteral(SimpleJavaParser.LiteralContext ctx);
T visitUnaryExpression(SimpleJavaParser.UnaryExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#booleanLiteral}.
* Visit a parse tree produced by {@link SimpleJavaParser#notExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBooleanLiteral(SimpleJavaParser.BooleanLiteralContext ctx);
T visitNotExpression(SimpleJavaParser.NotExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#charLiteral}.
* Visit a parse tree produced by {@link SimpleJavaParser#crementExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCharLiteral(SimpleJavaParser.CharLiteralContext ctx);
T visitCrementExpression(SimpleJavaParser.CrementExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#incrementExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIncrementExpression(SimpleJavaParser.IncrementExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#prefixIncrementExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPrefixIncrementExpression(SimpleJavaParser.PrefixIncrementExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#suffixIncrementExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSuffixIncrementExpression(SimpleJavaParser.SuffixIncrementExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#decrementExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDecrementExpression(SimpleJavaParser.DecrementExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#prefixDecrementExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPrefixDecrementExpression(SimpleJavaParser.PrefixDecrementExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#suffixDecrementExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSuffixDecrementExpression(SimpleJavaParser.SuffixDecrementExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#assignableExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAssignableExpression(SimpleJavaParser.AssignableExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#memberAccess}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMemberAccess(SimpleJavaParser.MemberAccessContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#binaryExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBinaryExpression(SimpleJavaParser.BinaryExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#calculationExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCalculationExpression(SimpleJavaParser.CalculationExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#dotExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDotExpression(SimpleJavaParser.DotExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#dotSubtractionExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDotSubtractionExpression(SimpleJavaParser.DotSubtractionExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#nonCalculationExpression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNonCalculationExpression(SimpleJavaParser.NonCalculationExpressionContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#methodCall}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMethodCall(SimpleJavaParser.MethodCallContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#target}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTarget(SimpleJavaParser.TargetContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#chainedMethod}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitChainedMethod(SimpleJavaParser.ChainedMethodContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType(SimpleJavaParser.TypeContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValue(SimpleJavaParser.ValueContext ctx);
/**
* Visit a parse tree produced by {@link SimpleJavaParser#nonCalculationOperator}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNonCalculationOperator(SimpleJavaParser.NonCalculationOperatorContext ctx);
}

Some files were not shown because too many files have changed in this diff Show More