parser #3

Merged
i22005 merged 4 commits from parser into main 2024-05-09 12:06:31 +00:00
10 changed files with 421 additions and 262 deletions
Showing only changes of commit 0bce8639f5 - Show all commits

4
.idea/misc.xml generated
View File

@ -6,10 +6,10 @@
<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\Maxi\Documents\DHBW\Compilerbau\NichtHaskell2.0\src\main\java\parser" />
<option name="libDir" value="" />
<option name="encoding" value="" />
<option name="pkg" value="" />
<option name="pkg" value="generated" />
<option name="language" value="" />
<option name="generateVisitor" value="true" />
</PerGrammarGenerationSettings>

View File

@ -2,6 +2,10 @@ public class Example {
public int test;
public Example(int conInput) {
}
public static int test(char b){
test = 3;

View File

@ -4,12 +4,14 @@ program : classDeclaration+;
classDeclaration : accessType 'class' IDENTIFIER '{' memberDeclaration* '}';
memberDeclaration : fieldDeclaration | methodDeclaration;
memberDeclaration : fieldDeclaration | methodDeclaration | constructorDeclaration;
fieldDeclaration : accessType type IDENTIFIER ';';
methodDeclaration : accessType 'static' type IDENTIFIER '(' parameterList? ')' '{' statement* '}' ;
constructorDeclaration : accessType IDENTIFIER '(' parameterList? ')' '{' statement* '}' ;
parameterList : parameter (',' parameter)* ;
parameter : type IDENTIFIER ;

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/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.ParserRuleContext;
@ -72,6 +72,18 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext 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}
*

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/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
@ -47,6 +47,13 @@ public class SimpleJavaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implem
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext 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}
*

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/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;

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/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.ParseTreeListener;
@ -57,6 +57,16 @@ public interface SimpleJavaListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext 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#parameterList}.
* @param ctx the parse tree

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/SimpleJava.g4 by ANTLR 4.13.1
package parser.generated;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
@ -40,6 +40,12 @@ public interface SimpleJavaVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext 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#parameterList}.
* @param ctx the parse tree