Compare commits
2 Commits
d270992858
...
56c32fe9d3
Author | SHA1 | Date | |
---|---|---|---|
|
56c32fe9d3 | ||
|
fe689b7253 |
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -40,7 +40,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
21
pom.xml
21
pom.xml
@ -14,4 +14,25 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- JUnit dependency -->
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-engine</artifactId>
|
||||
<version>5.9.3</version> <!-- Change the version as needed -->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Add the Maven Surefire plugin to run tests -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>3.0.0-M5</version> <!-- Change the version as needed -->
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
18
src/main/test/java/MainTest.java
Normal file
18
src/main/test/java/MainTest.java
Normal file
@ -0,0 +1,18 @@
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
|
||||
public class MainTest {
|
||||
@Test
|
||||
void testAdd() {
|
||||
//Calculator calculator = new Calculator();
|
||||
//int result = calculator.add(2, 3);
|
||||
//assertEquals(5, result, "2 + 3 should equal 5");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* run: mvn test
|
||||
*/
|
48
src/main/test/java/TestSpecs.md
Normal file
48
src/main/test/java/TestSpecs.md
Normal file
@ -0,0 +1,48 @@
|
||||
# Scanner
|
||||
## Scanner Input
|
||||
### Beispiel 1: Empty Class
|
||||
|
||||
String empty class = "class name {}";
|
||||
|
||||
### Beispiel 2: Filled Class
|
||||
|
||||
String filled class =
|
||||
"class Example {" +
|
||||
"if (x < 5) {" +
|
||||
"for (int i = 0; i < 10; i++) {" +
|
||||
"while (true) {" +
|
||||
"x = 5;" +
|
||||
"}"
|
||||
|
||||
## Scanner Output
|
||||
### Beispiel 1: Empty Class
|
||||
|
||||
[TokClass,TokIdentifier "name",TokLeftBrace,TokRightBrace]
|
||||
|
||||
### Beispiel 2: Filled Class
|
||||
|
||||
[TokClass,TokIdentifier "Example",TokLeftBrace]
|
||||
[TokIf,TokLeftParen,TokIdentifier "x",TokLessThan,TokNumber 5,TokRightParen,TokLeftBrace]
|
||||
[TokFor,TokLeftParen,TokIdentifier "int",TokIdentifier "i",TokAssign,TokNumber 0,TokSemicolon,TokIdentifier "i",TokLessThan,TokNumber 10,TokSemicolon,TokIdentifier "i",TokPlus,TokPlus,TokRightParen,TokLeftBrace]
|
||||
[TokWhile,TokLeftParen,TokIdentifier "true",TokRightParen,TokLeftBrace]
|
||||
[TokIdentifier "x",TokAssign,TokNumber 5,TokSemicolon]
|
||||
[TokRightBrace]
|
||||
|
||||
# Parser
|
||||
## Parser Input
|
||||
(Scanner Output)
|
||||
|
||||
## Parser Output -> AST
|
||||
### Beispiel 1: Empty Class
|
||||
|
||||
|
||||
|
||||
### Beispiel 2: Filled Class
|
||||
|
||||
|
||||
|
||||
# Semantische Analyse / Typcheck
|
||||
|
||||
# Bytecodegenerierung
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user