Compare commits
5 Commits
b2e86ca631
...
c4a35decba
Author | SHA1 | Date | |
---|---|---|---|
|
c4a35decba | ||
|
3cbef38c5e | ||
|
7c54c0f04c | ||
|
5529704693 | ||
|
8fbe7d0800 |
@ -9,6 +9,9 @@ import parser.ASTBuilder;
|
|||||||
import parser.generated.SimpleJavaLexer;
|
import parser.generated.SimpleJavaLexer;
|
||||||
import parser.generated.SimpleJavaParser;
|
import parser.generated.SimpleJavaParser;
|
||||||
import semantic.SemanticAnalyzer;
|
import semantic.SemanticAnalyzer;
|
||||||
|
import ast.ClassNode;
|
||||||
|
import ast.ProgramNode;
|
||||||
|
import bytecode.ByteCodeGenerator;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
@ -18,6 +21,7 @@ public class Main {
|
|||||||
CharStream codeCharStream = null;
|
CharStream codeCharStream = null;
|
||||||
try {
|
try {
|
||||||
codeCharStream = CharStreams.fromPath(Paths.get("src/main/resources/Example.txt"));
|
codeCharStream = CharStreams.fromPath(Paths.get("src/main/resources/Example.txt"));
|
||||||
|
codeCharStream = CharStreams.fromPath(Paths.get("src\\main\\java\\Example.java"));
|
||||||
parsefile(codeCharStream);
|
parsefile(codeCharStream);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.err.println("Error reading the file: " + e.getMessage());
|
System.err.println("Error reading the file: " + e.getMessage());
|
||||||
|
9
src/main/java/ast/AccessTypeNode.java
Normal file
9
src/main/java/ast/AccessTypeNode.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package ast;
|
||||||
|
|
||||||
|
public class AccessTypeNode extends ASTNode {
|
||||||
|
public EnumAccessTypeNode enumAccessTypeNode;
|
||||||
|
|
||||||
|
public AccessTypeNode(EnumAccessTypeNode enumAccessTypeNode) {
|
||||||
|
this.enumAccessTypeNode = enumAccessTypeNode;
|
||||||
|
}
|
||||||
|
}
|
@ -5,9 +5,16 @@ import java.util.List;
|
|||||||
|
|
||||||
public class ClassNode extends ASTNode{
|
public class ClassNode extends ASTNode{
|
||||||
public Identifier identifier;
|
public Identifier identifier;
|
||||||
|
public AccessTypeNode accessType;
|
||||||
|
public String name;
|
||||||
public List<MemberNode> members = new ArrayList<>();
|
public List<MemberNode> members = new ArrayList<>();
|
||||||
public boolean hasConstructor = false;
|
public boolean hasConstructor = false;
|
||||||
|
|
||||||
|
public ClassNode(AccessTypeNode accessType, String name){
|
||||||
|
this.accessType = accessType;
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
public void addMember(MemberNode member) {
|
public void addMember(MemberNode member) {
|
||||||
if (member instanceof ConstructorNode) {
|
if (member instanceof ConstructorNode) {
|
||||||
this.hasConstructor = true;
|
this.hasConstructor = true;
|
||||||
@ -17,7 +24,7 @@ public class ClassNode extends ASTNode{
|
|||||||
|
|
||||||
public void ensureConstructor(){
|
public void ensureConstructor(){
|
||||||
if(!hasConstructor) {
|
if(!hasConstructor) {
|
||||||
ConstructorNode constructor = new ConstructorNode(new TypeNode("public"), identifier.getName());
|
ConstructorNode constructor = new ConstructorNode(new AccessTypeNode(EnumAccessTypeNode.PUBLIC), name);
|
||||||
members.add(0,constructor);
|
members.add(0,constructor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package ast;
|
package ast;
|
||||||
|
|
||||||
public class ConstructorNode extends MethodNode{
|
public class ConstructorNode extends MethodNode{
|
||||||
public ConstructorNode(TypeNode visibility, String name) {
|
public ConstructorNode(AccessTypeNode visibility, String name) {
|
||||||
super(visibility, name);
|
super(visibility, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
src/main/java/ast/EnumAccessTypeNode.java
Normal file
5
src/main/java/ast/EnumAccessTypeNode.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package ast;
|
||||||
|
|
||||||
|
public enum EnumAccessTypeNode {
|
||||||
|
PUBLIC, PRIVATE
|
||||||
|
}
|
5
src/main/java/ast/EnumTypeNode.java
Normal file
5
src/main/java/ast/EnumTypeNode.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package ast;
|
||||||
|
|
||||||
|
public enum EnumTypeNode {
|
||||||
|
INT, BOOLEAN, CHAR
|
||||||
|
}
|
@ -1,10 +1,12 @@
|
|||||||
package ast;
|
package ast;
|
||||||
|
|
||||||
public class FieldNode extends MemberNode {
|
public class FieldNode extends MemberNode {
|
||||||
|
public AccessTypeNode accessTypeNode;
|
||||||
public TypeNode type;
|
public TypeNode type;
|
||||||
public Identifier identifier;
|
public Identifier identifier;
|
||||||
|
|
||||||
public FieldNode(TypeNode type, String name){
|
public FieldNode(AccessTypeNode accessTypeNode, TypeNode type, String name){
|
||||||
|
this.accessTypeNode = accessTypeNode;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.identifier = new Identifier(name);
|
this.identifier = new Identifier(name);
|
||||||
}
|
}
|
||||||
|
@ -6,20 +6,25 @@ import java.util.List;
|
|||||||
public class MethodNode extends MemberNode{
|
public class MethodNode extends MemberNode{
|
||||||
public TypeNode visibility;
|
public TypeNode visibility;
|
||||||
public Identifier identifier;
|
public Identifier identifier;
|
||||||
|
public AccessTypeNode visibility;
|
||||||
|
public TypeNode type;
|
||||||
|
public String name;
|
||||||
|
|
||||||
public ParameterListNode parameters;
|
public ParameterListNode parameters;
|
||||||
|
|
||||||
public List<StatementNode> statements = new ArrayList<>();
|
public List<StatementNode> statements = new ArrayList<>();
|
||||||
|
|
||||||
public MethodNode(TypeNode visibility, String name, ParameterListNode parameters,
|
public MethodNode(AccessTypeNode visibility, TypeNode type, String name, ParameterListNode parameters,
|
||||||
List<StatementNode> statements){
|
List<StatementNode> statements){
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
this.identifier = new Identifier(name);
|
this.identifier = new Identifier(name);
|
||||||
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
this.parameters = parameters;
|
this.parameters = parameters;
|
||||||
this.statements = statements;
|
this.statements = statements;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MethodNode(TypeNode visibility, String name){
|
public MethodNode(AccessTypeNode visibility, String name){
|
||||||
this.visibility = visibility;
|
this.visibility = visibility;
|
||||||
this.identifier = new Identifier(name);
|
this.identifier = new Identifier(name);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package ast;
|
package ast;
|
||||||
|
|
||||||
public class TypeNode extends ASTNode {
|
public class TypeNode extends ASTNode {
|
||||||
public String typeName;
|
public EnumTypeNode enumTypeNode;
|
||||||
|
|
||||||
public TypeNode(String typeName) {
|
public TypeNode(EnumTypeNode enumTypeNode) {
|
||||||
this.typeName = typeName;
|
this.enumTypeNode = enumTypeNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -21,22 +21,25 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
|
|||||||
public ASTNode visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) {
|
public ASTNode visitClassDeclaration(SimpleJavaParser.ClassDeclarationContext ctx) {
|
||||||
ClassNode classNode = new ClassNode();
|
ClassNode classNode = new ClassNode();
|
||||||
classNode.identifier = new Identifier(ctx.IDENTIFIER().getText());
|
classNode.identifier = new Identifier(ctx.IDENTIFIER().getText());
|
||||||
|
ClassNode classNode = new ClassNode((AccessTypeNode) visit(ctx.accessType()),ctx.IDENTIFIER().getText());
|
||||||
for (SimpleJavaParser.MemberDeclarationContext member : ctx.memberDeclaration()) {
|
for (SimpleJavaParser.MemberDeclarationContext member : ctx.memberDeclaration()) {
|
||||||
classNode.addMember((MemberNode) visit(member));
|
classNode.addMember((MemberNode) visit(member));
|
||||||
}
|
}
|
||||||
classNode.ensureConstructor(); // Check and add default constructor if needed
|
classNode.ensureConstructor();
|
||||||
return classNode;
|
return classNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ASTNode visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) {
|
public ASTNode visitFieldDeclaration(SimpleJavaParser.FieldDeclarationContext ctx) {
|
||||||
|
AccessTypeNode accessType = (AccessTypeNode) visit(ctx.accessType());
|
||||||
TypeNode type = (TypeNode) visit(ctx.type());
|
TypeNode type = (TypeNode) visit(ctx.type());
|
||||||
String identifier = ctx.IDENTIFIER().getText();
|
String identifier = ctx.IDENTIFIER().getText();
|
||||||
return new FieldNode(type, identifier);
|
return new FieldNode(accessType, type, identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ASTNode visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx) {
|
public ASTNode visitMethodDeclaration(SimpleJavaParser.MethodDeclarationContext ctx) {
|
||||||
|
AccessTypeNode accessType = (AccessTypeNode) visit(ctx.accessType());
|
||||||
TypeNode returnType = (TypeNode) visit(ctx.type());
|
TypeNode returnType = (TypeNode) visit(ctx.type());
|
||||||
String methodName = ctx.IDENTIFIER().getText();
|
String methodName = ctx.IDENTIFIER().getText();
|
||||||
ParameterListNode parameterListNode = (ParameterListNode) visit(ctx.parameterList());
|
ParameterListNode parameterListNode = (ParameterListNode) visit(ctx.parameterList());
|
||||||
@ -45,27 +48,11 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
|
|||||||
statements.add((StatementNode) visit(stmtCtx));
|
statements.add((StatementNode) visit(stmtCtx));
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodNode method = new MethodNode(returnType, methodName, parameterListNode, statements);
|
MethodNode method = new MethodNode(accessType,returnType, methodName, parameterListNode, statements);
|
||||||
|
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ASTNode visitType(SimpleJavaParser.TypeContext ctx) {
|
|
||||||
return new TypeNode(ctx.getText());
|
|
||||||
}
|
|
||||||
|
|
||||||
@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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ASTNode visitParameterList(SimpleJavaParser.ParameterListContext ctx) {
|
public ASTNode visitParameterList(SimpleJavaParser.ParameterListContext ctx) {
|
||||||
List<ParameterNode> parameters = new ArrayList<>();
|
List<ParameterNode> parameters = new ArrayList<>();
|
||||||
@ -77,10 +64,48 @@ public class ASTBuilder extends SimpleJavaBaseVisitor<ASTNode> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ASTNode visitParameter(SimpleJavaParser.ParameterContext ctx) {
|
public ASTNode visitParameter(SimpleJavaParser.ParameterContext ctx) {
|
||||||
TypeNode type = (TypeNode) visit(ctx.type()); // Assuming visitType returns a TypeNode
|
TypeNode type = (TypeNode) visit(ctx.type());
|
||||||
String identifier = ctx.IDENTIFIER().getText();
|
String identifier = ctx.IDENTIFIER().getText();
|
||||||
return new ParameterNode(type, identifier);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,18 +2,19 @@ grammar SimpleJava;
|
|||||||
|
|
||||||
program : classDeclaration+;
|
program : classDeclaration+;
|
||||||
|
|
||||||
classDeclaration : 'class' IDENTIFIER '{' memberDeclaration* '}';
|
classDeclaration : accessType 'class' IDENTIFIER '{' memberDeclaration* '}';
|
||||||
|
|
||||||
memberDeclaration : fieldDeclaration | methodDeclaration;
|
memberDeclaration : fieldDeclaration | methodDeclaration;
|
||||||
|
|
||||||
fieldDeclaration : type IDENTIFIER ';';
|
fieldDeclaration : accessType type IDENTIFIER ';';
|
||||||
|
|
||||||
methodDeclaration : 'public' 'static' type IDENTIFIER '(' parameterList? ')' '{' statement* '}' ;
|
methodDeclaration : accessType 'static' type IDENTIFIER '(' parameterList? ')' '{' statement* '}' ;
|
||||||
|
|
||||||
parameterList : parameter (',' parameter)* ;
|
parameterList : parameter (',' parameter)* ;
|
||||||
parameter : type IDENTIFIER ;
|
parameter : type IDENTIFIER ;
|
||||||
|
|
||||||
type : 'int' | 'boolean' | 'char' ;
|
type : 'int' | 'boolean' | 'char' ;
|
||||||
|
accessType : 'public' | 'private' ;
|
||||||
|
|
||||||
statement
|
statement
|
||||||
: variableDeclarationStatement
|
: variableDeclarationStatement
|
||||||
|
File diff suppressed because one or more lines are too long
@ -32,40 +32,42 @@ T__30=31
|
|||||||
T__31=32
|
T__31=32
|
||||||
T__32=33
|
T__32=33
|
||||||
T__33=34
|
T__33=34
|
||||||
INTEGERLITERAL=35
|
T__34=35
|
||||||
IDENTIFIER=36
|
INTEGERLITERAL=36
|
||||||
WS=37
|
IDENTIFIER=37
|
||||||
|
WS=38
|
||||||
'class'=1
|
'class'=1
|
||||||
'{'=2
|
'{'=2
|
||||||
'}'=3
|
'}'=3
|
||||||
';'=4
|
';'=4
|
||||||
'public'=5
|
'static'=5
|
||||||
'static'=6
|
'('=6
|
||||||
'('=7
|
')'=7
|
||||||
')'=8
|
','=8
|
||||||
','=9
|
'int'=9
|
||||||
'int'=10
|
'boolean'=10
|
||||||
'boolean'=11
|
'char'=11
|
||||||
'char'=12
|
'public'=12
|
||||||
'='=13
|
'private'=13
|
||||||
'if'=14
|
'='=14
|
||||||
'else'=15
|
'if'=15
|
||||||
'while'=16
|
'else'=16
|
||||||
'return'=17
|
'while'=17
|
||||||
'&&'=18
|
'return'=18
|
||||||
'||'=19
|
'&&'=19
|
||||||
'=='=20
|
'||'=20
|
||||||
'!='=21
|
'=='=21
|
||||||
'<'=22
|
'!='=22
|
||||||
'<='=23
|
'<'=23
|
||||||
'>'=24
|
'<='=24
|
||||||
'>='=25
|
'>'=25
|
||||||
'+'=26
|
'>='=26
|
||||||
'-'=27
|
'+'=27
|
||||||
'*'=28
|
'-'=28
|
||||||
'/'=29
|
'*'=29
|
||||||
'%'=30
|
'/'=30
|
||||||
'!'=31
|
'%'=31
|
||||||
'true'=32
|
'!'=32
|
||||||
'false'=33
|
'true'=33
|
||||||
'\''=34
|
'false'=34
|
||||||
|
'\''=35
|
||||||
|
@ -108,6 +108,18 @@ public class SimpleJavaBaseListener implements SimpleJavaListener {
|
|||||||
* <p>The default implementation does nothing.</p>
|
* <p>The default implementation does nothing.</p>
|
||||||
*/
|
*/
|
||||||
@Override public void exitType(SimpleJavaParser.TypeContext ctx) { }
|
@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) { }
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
|
@ -68,6 +68,13 @@ public class SimpleJavaBaseVisitor<T> extends AbstractParseTreeVisitor<T> implem
|
|||||||
* {@link #visitChildren} on {@code ctx}.</p>
|
* {@link #visitChildren} on {@code ctx}.</p>
|
||||||
*/
|
*/
|
||||||
@Override public T visitType(SimpleJavaParser.TypeContext ctx) { return visitChildren(ctx); }
|
@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); }
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
*
|
||||||
|
File diff suppressed because one or more lines are too long
@ -21,7 +21,8 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
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__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__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__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, INTEGERLITERAL=35, IDENTIFIER=36, WS=37;
|
T__31=32, T__32=33, T__33=34, T__34=35, INTEGERLITERAL=36, IDENTIFIER=37,
|
||||||
|
WS=38;
|
||||||
public static String[] channelNames = {
|
public static String[] channelNames = {
|
||||||
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
||||||
};
|
};
|
||||||
@ -36,18 +37,18 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
"T__9", "T__10", "T__11", "T__12", "T__13", "T__14", "T__15", "T__16",
|
"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__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__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32",
|
||||||
"T__33", "INTEGERLITERAL", "IDENTIFIER", "WS"
|
"T__33", "T__34", "INTEGERLITERAL", "IDENTIFIER", "WS"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public static final String[] ruleNames = makeRuleNames();
|
public static final String[] ruleNames = makeRuleNames();
|
||||||
|
|
||||||
private static String[] makeLiteralNames() {
|
private static String[] makeLiteralNames() {
|
||||||
return new String[] {
|
return new String[] {
|
||||||
null, "'class'", "'{'", "'}'", "';'", "'public'", "'static'", "'('",
|
null, "'class'", "'{'", "'}'", "';'", "'static'", "'('", "')'", "','",
|
||||||
"')'", "','", "'int'", "'boolean'", "'char'", "'='", "'if'", "'else'",
|
"'int'", "'boolean'", "'char'", "'public'", "'private'", "'='", "'if'",
|
||||||
"'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'", "'<='",
|
"'else'", "'while'", "'return'", "'&&'", "'||'", "'=='", "'!='", "'<'",
|
||||||
"'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'", "'false'",
|
"'<='", "'>'", "'>='", "'+'", "'-'", "'*'", "'/'", "'%'", "'!'", "'true'",
|
||||||
"'''"
|
"'false'", "'''"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
private static final String[] _LITERAL_NAMES = makeLiteralNames();
|
||||||
@ -55,8 +56,8 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
return new String[] {
|
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,
|
null, null, null, null, null, null, null, null, null, null, null, null,
|
||||||
null, null, null, null, null, null, null, null, null, null, null, "INTEGERLITERAL",
|
null, null, null, null, null, null, null, null, null, null, null, null,
|
||||||
"IDENTIFIER", "WS"
|
"INTEGERLITERAL", "IDENTIFIER", "WS"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
|
||||||
@ -118,7 +119,7 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
public ATN getATN() { return _ATN; }
|
public ATN getATN() { return _ATN; }
|
||||||
|
|
||||||
public static final String _serializedATN =
|
public static final String _serializedATN =
|
||||||
"\u0004\u0000%\u00d5\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
|
"\u0004\u0000&\u00df\u0006\uffff\uffff\u0002\u0000\u0007\u0000\u0002\u0001"+
|
||||||
"\u0007\u0001\u0002\u0002\u0007\u0002\u0002\u0003\u0007\u0003\u0002\u0004"+
|
"\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\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"+
|
"\u0007\u0007\u0002\b\u0007\b\u0002\t\u0007\t\u0002\n\u0007\n\u0002\u000b"+
|
||||||
@ -129,123 +130,128 @@ public class SimpleJavaLexer extends Lexer {
|
|||||||
"\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+
|
"\u0018\u0007\u0018\u0002\u0019\u0007\u0019\u0002\u001a\u0007\u001a\u0002"+
|
||||||
"\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+
|
"\u001b\u0007\u001b\u0002\u001c\u0007\u001c\u0002\u001d\u0007\u001d\u0002"+
|
||||||
"\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+
|
"\u001e\u0007\u001e\u0002\u001f\u0007\u001f\u0002 \u0007 \u0002!\u0007"+
|
||||||
"!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0001\u0000\u0001\u0000"+
|
"!\u0002\"\u0007\"\u0002#\u0007#\u0002$\u0007$\u0002%\u0007%\u0001\u0000"+
|
||||||
"\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001\u0001\u0001"+
|
"\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0000\u0001\u0001"+
|
||||||
"\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004\u0001\u0004"+
|
"\u0001\u0001\u0001\u0002\u0001\u0002\u0001\u0003\u0001\u0003\u0001\u0004"+
|
||||||
"\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0005"+
|
"\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004\u0001\u0004"+
|
||||||
"\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005\u0001\u0005"+
|
"\u0001\u0005\u0001\u0005\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007"+
|
||||||
"\u0001\u0006\u0001\u0006\u0001\u0007\u0001\u0007\u0001\b\u0001\b\u0001"+
|
"\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"+
|
"\t\u0001\t\u0001\t\u0001\t\u0001\n\u0001\n\u0001\n\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\u000b\u0001\u000b\u0001\u000b\u0001"+
|
||||||
"\u000b\u0001\f\u0001\f\u0001\r\u0001\r\u0001\r\u0001\u000e\u0001\u000e"+
|
"\u000b\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f\u0001\f"+
|
||||||
"\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001\u000f\u0001\u000f"+
|
"\u0001\r\u0001\r\u0001\u000e\u0001\u000e\u0001\u000e\u0001\u000f\u0001"+
|
||||||
"\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001\u0010"+
|
"\u000f\u0001\u000f\u0001\u000f\u0001\u000f\u0001\u0010\u0001\u0010\u0001"+
|
||||||
"\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011"+
|
"\u0010\u0001\u0010\u0001\u0010\u0001\u0010\u0001\u0011\u0001\u0011\u0001"+
|
||||||
"\u0001\u0011\u0001\u0012\u0001\u0012\u0001\u0012\u0001\u0013\u0001\u0013"+
|
"\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0011\u0001\u0012\u0001"+
|
||||||
"\u0001\u0013\u0001\u0014\u0001\u0014\u0001\u0014\u0001\u0015\u0001\u0015"+
|
"\u0012\u0001\u0012\u0001\u0013\u0001\u0013\u0001\u0013\u0001\u0014\u0001"+
|
||||||
"\u0001\u0016\u0001\u0016\u0001\u0016\u0001\u0017\u0001\u0017\u0001\u0018"+
|
"\u0014\u0001\u0014\u0001\u0015\u0001\u0015\u0001\u0015\u0001\u0016\u0001"+
|
||||||
"\u0001\u0018\u0001\u0018\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a"+
|
"\u0016\u0001\u0017\u0001\u0017\u0001\u0017\u0001\u0018\u0001\u0018\u0001"+
|
||||||
"\u0001\u001b\u0001\u001b\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d"+
|
"\u0019\u0001\u0019\u0001\u0019\u0001\u001a\u0001\u001a\u0001\u001b\u0001"+
|
||||||
"\u0001\u001e\u0001\u001e\u0001\u001f\u0001\u001f\u0001\u001f\u0001\u001f"+
|
"\u001b\u0001\u001c\u0001\u001c\u0001\u001d\u0001\u001d\u0001\u001e\u0001"+
|
||||||
"\u0001\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001 \u0001!\u0001!\u0001"+
|
"\u001e\u0001\u001f\u0001\u001f\u0001 \u0001 \u0001 \u0001 \u0001 \u0001"+
|
||||||
"\"\u0004\"\u00c4\b\"\u000b\"\f\"\u00c5\u0001#\u0001#\u0005#\u00ca\b#\n"+
|
"!\u0001!\u0001!\u0001!\u0001!\u0001!\u0001\"\u0001\"\u0001#\u0004#\u00ce"+
|
||||||
"#\f#\u00cd\t#\u0001$\u0004$\u00d0\b$\u000b$\f$\u00d1\u0001$\u0001$\u0000"+
|
"\b#\u000b#\f#\u00cf\u0001$\u0001$\u0005$\u00d4\b$\n$\f$\u00d7\t$\u0001"+
|
||||||
"\u0000%\u0001\u0001\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b"+
|
"%\u0004%\u00da\b%\u000b%\f%\u00db\u0001%\u0001%\u0000\u0000&\u0001\u0001"+
|
||||||
"\u0006\r\u0007\u000f\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b"+
|
"\u0003\u0002\u0005\u0003\u0007\u0004\t\u0005\u000b\u0006\r\u0007\u000f"+
|
||||||
"\u000e\u001d\u000f\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016"+
|
"\b\u0011\t\u0013\n\u0015\u000b\u0017\f\u0019\r\u001b\u000e\u001d\u000f"+
|
||||||
"-\u0017/\u00181\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f? A!C\""+
|
"\u001f\u0010!\u0011#\u0012%\u0013\'\u0014)\u0015+\u0016-\u0017/\u0018"+
|
||||||
"E#G$I%\u0001\u0000\u0004\u0001\u000009\u0002\u0000AZaz\u0004\u000009A"+
|
"1\u00193\u001a5\u001b7\u001c9\u001d;\u001e=\u001f? A!C\"E#G$I%K&\u0001"+
|
||||||
"Z__az\u0003\u0000\t\n\r\r \u00d7\u0000\u0001\u0001\u0000\u0000\u0000"+
|
"\u0000\u0004\u0001\u000009\u0002\u0000AZaz\u0004\u000009AZ__az\u0003\u0000"+
|
||||||
"\u0000\u0003\u0001\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000"+
|
"\t\n\r\r \u00e1\u0000\u0001\u0001\u0000\u0000\u0000\u0000\u0003\u0001"+
|
||||||
"\u0000\u0007\u0001\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000"+
|
"\u0000\u0000\u0000\u0000\u0005\u0001\u0000\u0000\u0000\u0000\u0007\u0001"+
|
||||||
"\u000b\u0001\u0000\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f"+
|
"\u0000\u0000\u0000\u0000\t\u0001\u0000\u0000\u0000\u0000\u000b\u0001\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013"+
|
"\u0000\u0000\u0000\r\u0001\u0000\u0000\u0000\u0000\u000f\u0001\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017"+
|
"\u0000\u0000\u0011\u0001\u0000\u0000\u0000\u0000\u0013\u0001\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b"+
|
"\u0000\u0000\u0015\u0001\u0000\u0000\u0000\u0000\u0017\u0001\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f"+
|
"\u0000\u0000\u0019\u0001\u0000\u0000\u0000\u0000\u001b\u0001\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000"+
|
"\u0000\u0000\u001d\u0001\u0000\u0000\u0000\u0000\u001f\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000%\u0001\u0000\u0000\u0000\u0000\'\u0001\u0000\u0000"+
|
"\u0000\u0000!\u0001\u0000\u0000\u0000\u0000#\u0001\u0000\u0000\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"+
|
||||||
"-\u0001\u0000\u0000\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001"+
|
"\u0000\u0000\u0000\u0000+\u0001\u0000\u0000\u0000\u0000-\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u00003\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000"+
|
"\u0000\u0000/\u0001\u0000\u0000\u0000\u00001\u0001\u0000\u0000\u0000\u0000"+
|
||||||
"\u0000\u00007\u0001\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000"+
|
"3\u0001\u0000\u0000\u0000\u00005\u0001\u0000\u0000\u0000\u00007\u0001"+
|
||||||
";\u0001\u0000\u0000\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?\u0001"+
|
"\u0000\u0000\u0000\u00009\u0001\u0000\u0000\u0000\u0000;\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0000A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000"+
|
"\u0000\u0000=\u0001\u0000\u0000\u0000\u0000?\u0001\u0000\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000E\u0001\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000"+
|
"A\u0001\u0000\u0000\u0000\u0000C\u0001\u0000\u0000\u0000\u0000E\u0001"+
|
||||||
"I\u0001\u0000\u0000\u0000\u0001K\u0001\u0000\u0000\u0000\u0003Q\u0001"+
|
"\u0000\u0000\u0000\u0000G\u0001\u0000\u0000\u0000\u0000I\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u0005S\u0001\u0000\u0000\u0000\u0007U\u0001\u0000\u0000"+
|
"\u0000\u0000K\u0001\u0000\u0000\u0000\u0001M\u0001\u0000\u0000\u0000\u0003"+
|
||||||
"\u0000\tW\u0001\u0000\u0000\u0000\u000b^\u0001\u0000\u0000\u0000\re\u0001"+
|
"S\u0001\u0000\u0000\u0000\u0005U\u0001\u0000\u0000\u0000\u0007W\u0001"+
|
||||||
"\u0000\u0000\u0000\u000fg\u0001\u0000\u0000\u0000\u0011i\u0001\u0000\u0000"+
|
"\u0000\u0000\u0000\tY\u0001\u0000\u0000\u0000\u000b`\u0001\u0000\u0000"+
|
||||||
"\u0000\u0013k\u0001\u0000\u0000\u0000\u0015o\u0001\u0000\u0000\u0000\u0017"+
|
"\u0000\rb\u0001\u0000\u0000\u0000\u000fd\u0001\u0000\u0000\u0000\u0011"+
|
||||||
"w\u0001\u0000\u0000\u0000\u0019|\u0001\u0000\u0000\u0000\u001b~\u0001"+
|
"f\u0001\u0000\u0000\u0000\u0013j\u0001\u0000\u0000\u0000\u0015r\u0001"+
|
||||||
"\u0000\u0000\u0000\u001d\u0081\u0001\u0000\u0000\u0000\u001f\u0086\u0001"+
|
"\u0000\u0000\u0000\u0017w\u0001\u0000\u0000\u0000\u0019~\u0001\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000!\u008c\u0001\u0000\u0000\u0000#\u0093\u0001\u0000\u0000"+
|
"\u0000\u001b\u0086\u0001\u0000\u0000\u0000\u001d\u0088\u0001\u0000\u0000"+
|
||||||
"\u0000%\u0096\u0001\u0000\u0000\u0000\'\u0099\u0001\u0000\u0000\u0000"+
|
"\u0000\u001f\u008b\u0001\u0000\u0000\u0000!\u0090\u0001\u0000\u0000\u0000"+
|
||||||
")\u009c\u0001\u0000\u0000\u0000+\u009f\u0001\u0000\u0000\u0000-\u00a1"+
|
"#\u0096\u0001\u0000\u0000\u0000%\u009d\u0001\u0000\u0000\u0000\'\u00a0"+
|
||||||
"\u0001\u0000\u0000\u0000/\u00a4\u0001\u0000\u0000\u00001\u00a6\u0001\u0000"+
|
"\u0001\u0000\u0000\u0000)\u00a3\u0001\u0000\u0000\u0000+\u00a6\u0001\u0000"+
|
||||||
"\u0000\u00003\u00a9\u0001\u0000\u0000\u00005\u00ab\u0001\u0000\u0000\u0000"+
|
"\u0000\u0000-\u00a9\u0001\u0000\u0000\u0000/\u00ab\u0001\u0000\u0000\u0000"+
|
||||||
"7\u00ad\u0001\u0000\u0000\u00009\u00af\u0001\u0000\u0000\u0000;\u00b1"+
|
"1\u00ae\u0001\u0000\u0000\u00003\u00b0\u0001\u0000\u0000\u00005\u00b3"+
|
||||||
"\u0001\u0000\u0000\u0000=\u00b3\u0001\u0000\u0000\u0000?\u00b5\u0001\u0000"+
|
"\u0001\u0000\u0000\u00007\u00b5\u0001\u0000\u0000\u00009\u00b7\u0001\u0000"+
|
||||||
"\u0000\u0000A\u00ba\u0001\u0000\u0000\u0000C\u00c0\u0001\u0000\u0000\u0000"+
|
"\u0000\u0000;\u00b9\u0001\u0000\u0000\u0000=\u00bb\u0001\u0000\u0000\u0000"+
|
||||||
"E\u00c3\u0001\u0000\u0000\u0000G\u00c7\u0001\u0000\u0000\u0000I\u00cf"+
|
"?\u00bd\u0001\u0000\u0000\u0000A\u00bf\u0001\u0000\u0000\u0000C\u00c4"+
|
||||||
"\u0001\u0000\u0000\u0000KL\u0005c\u0000\u0000LM\u0005l\u0000\u0000MN\u0005"+
|
"\u0001\u0000\u0000\u0000E\u00ca\u0001\u0000\u0000\u0000G\u00cd\u0001\u0000"+
|
||||||
"a\u0000\u0000NO\u0005s\u0000\u0000OP\u0005s\u0000\u0000P\u0002\u0001\u0000"+
|
"\u0000\u0000I\u00d1\u0001\u0000\u0000\u0000K\u00d9\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000QR\u0005{\u0000\u0000R\u0004\u0001\u0000\u0000\u0000ST\u0005"+
|
"MN\u0005c\u0000\u0000NO\u0005l\u0000\u0000OP\u0005a\u0000\u0000PQ\u0005"+
|
||||||
"}\u0000\u0000T\u0006\u0001\u0000\u0000\u0000UV\u0005;\u0000\u0000V\b\u0001"+
|
"s\u0000\u0000QR\u0005s\u0000\u0000R\u0002\u0001\u0000\u0000\u0000ST\u0005"+
|
||||||
"\u0000\u0000\u0000WX\u0005p\u0000\u0000XY\u0005u\u0000\u0000YZ\u0005b"+
|
"{\u0000\u0000T\u0004\u0001\u0000\u0000\u0000UV\u0005}\u0000\u0000V\u0006"+
|
||||||
"\u0000\u0000Z[\u0005l\u0000\u0000[\\\u0005i\u0000\u0000\\]\u0005c\u0000"+
|
"\u0001\u0000\u0000\u0000WX\u0005;\u0000\u0000X\b\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000]\n\u0001\u0000\u0000\u0000^_\u0005s\u0000\u0000_`\u0005t\u0000"+
|
"YZ\u0005s\u0000\u0000Z[\u0005t\u0000\u0000[\\\u0005a\u0000\u0000\\]\u0005"+
|
||||||
"\u0000`a\u0005a\u0000\u0000ab\u0005t\u0000\u0000bc\u0005i\u0000\u0000"+
|
"t\u0000\u0000]^\u0005i\u0000\u0000^_\u0005c\u0000\u0000_\n\u0001\u0000"+
|
||||||
"cd\u0005c\u0000\u0000d\f\u0001\u0000\u0000\u0000ef\u0005(\u0000\u0000"+
|
"\u0000\u0000`a\u0005(\u0000\u0000a\f\u0001\u0000\u0000\u0000bc\u0005)"+
|
||||||
"f\u000e\u0001\u0000\u0000\u0000gh\u0005)\u0000\u0000h\u0010\u0001\u0000"+
|
"\u0000\u0000c\u000e\u0001\u0000\u0000\u0000de\u0005,\u0000\u0000e\u0010"+
|
||||||
"\u0000\u0000ij\u0005,\u0000\u0000j\u0012\u0001\u0000\u0000\u0000kl\u0005"+
|
"\u0001\u0000\u0000\u0000fg\u0005i\u0000\u0000gh\u0005n\u0000\u0000hi\u0005"+
|
||||||
"i\u0000\u0000lm\u0005n\u0000\u0000mn\u0005t\u0000\u0000n\u0014\u0001\u0000"+
|
"t\u0000\u0000i\u0012\u0001\u0000\u0000\u0000jk\u0005b\u0000\u0000kl\u0005"+
|
||||||
"\u0000\u0000op\u0005b\u0000\u0000pq\u0005o\u0000\u0000qr\u0005o\u0000"+
|
"o\u0000\u0000lm\u0005o\u0000\u0000mn\u0005l\u0000\u0000no\u0005e\u0000"+
|
||||||
"\u0000rs\u0005l\u0000\u0000st\u0005e\u0000\u0000tu\u0005a\u0000\u0000"+
|
"\u0000op\u0005a\u0000\u0000pq\u0005n\u0000\u0000q\u0014\u0001\u0000\u0000"+
|
||||||
"uv\u0005n\u0000\u0000v\u0016\u0001\u0000\u0000\u0000wx\u0005c\u0000\u0000"+
|
"\u0000rs\u0005c\u0000\u0000st\u0005h\u0000\u0000tu\u0005a\u0000\u0000"+
|
||||||
"xy\u0005h\u0000\u0000yz\u0005a\u0000\u0000z{\u0005r\u0000\u0000{\u0018"+
|
"uv\u0005r\u0000\u0000v\u0016\u0001\u0000\u0000\u0000wx\u0005p\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000|}\u0005=\u0000\u0000}\u001a\u0001\u0000\u0000"+
|
"xy\u0005u\u0000\u0000yz\u0005b\u0000\u0000z{\u0005l\u0000\u0000{|\u0005"+
|
||||||
"\u0000~\u007f\u0005i\u0000\u0000\u007f\u0080\u0005f\u0000\u0000\u0080"+
|
"i\u0000\u0000|}\u0005c\u0000\u0000}\u0018\u0001\u0000\u0000\u0000~\u007f"+
|
||||||
"\u001c\u0001\u0000\u0000\u0000\u0081\u0082\u0005e\u0000\u0000\u0082\u0083"+
|
"\u0005p\u0000\u0000\u007f\u0080\u0005r\u0000\u0000\u0080\u0081\u0005i"+
|
||||||
"\u0005l\u0000\u0000\u0083\u0084\u0005s\u0000\u0000\u0084\u0085\u0005e"+
|
"\u0000\u0000\u0081\u0082\u0005v\u0000\u0000\u0082\u0083\u0005a\u0000\u0000"+
|
||||||
"\u0000\u0000\u0085\u001e\u0001\u0000\u0000\u0000\u0086\u0087\u0005w\u0000"+
|
"\u0083\u0084\u0005t\u0000\u0000\u0084\u0085\u0005e\u0000\u0000\u0085\u001a"+
|
||||||
"\u0000\u0087\u0088\u0005h\u0000\u0000\u0088\u0089\u0005i\u0000\u0000\u0089"+
|
"\u0001\u0000\u0000\u0000\u0086\u0087\u0005=\u0000\u0000\u0087\u001c\u0001"+
|
||||||
"\u008a\u0005l\u0000\u0000\u008a\u008b\u0005e\u0000\u0000\u008b \u0001"+
|
"\u0000\u0000\u0000\u0088\u0089\u0005i\u0000\u0000\u0089\u008a\u0005f\u0000"+
|
||||||
"\u0000\u0000\u0000\u008c\u008d\u0005r\u0000\u0000\u008d\u008e\u0005e\u0000"+
|
"\u0000\u008a\u001e\u0001\u0000\u0000\u0000\u008b\u008c\u0005e\u0000\u0000"+
|
||||||
"\u0000\u008e\u008f\u0005t\u0000\u0000\u008f\u0090\u0005u\u0000\u0000\u0090"+
|
"\u008c\u008d\u0005l\u0000\u0000\u008d\u008e\u0005s\u0000\u0000\u008e\u008f"+
|
||||||
"\u0091\u0005r\u0000\u0000\u0091\u0092\u0005n\u0000\u0000\u0092\"\u0001"+
|
"\u0005e\u0000\u0000\u008f \u0001\u0000\u0000\u0000\u0090\u0091\u0005w"+
|
||||||
"\u0000\u0000\u0000\u0093\u0094\u0005&\u0000\u0000\u0094\u0095\u0005&\u0000"+
|
"\u0000\u0000\u0091\u0092\u0005h\u0000\u0000\u0092\u0093\u0005i\u0000\u0000"+
|
||||||
"\u0000\u0095$\u0001\u0000\u0000\u0000\u0096\u0097\u0005|\u0000\u0000\u0097"+
|
"\u0093\u0094\u0005l\u0000\u0000\u0094\u0095\u0005e\u0000\u0000\u0095\""+
|
||||||
"\u0098\u0005|\u0000\u0000\u0098&\u0001\u0000\u0000\u0000\u0099\u009a\u0005"+
|
"\u0001\u0000\u0000\u0000\u0096\u0097\u0005r\u0000\u0000\u0097\u0098\u0005"+
|
||||||
"=\u0000\u0000\u009a\u009b\u0005=\u0000\u0000\u009b(\u0001\u0000\u0000"+
|
"e\u0000\u0000\u0098\u0099\u0005t\u0000\u0000\u0099\u009a\u0005u\u0000"+
|
||||||
"\u0000\u009c\u009d\u0005!\u0000\u0000\u009d\u009e\u0005=\u0000\u0000\u009e"+
|
"\u0000\u009a\u009b\u0005r\u0000\u0000\u009b\u009c\u0005n\u0000\u0000\u009c"+
|
||||||
"*\u0001\u0000\u0000\u0000\u009f\u00a0\u0005<\u0000\u0000\u00a0,\u0001"+
|
"$\u0001\u0000\u0000\u0000\u009d\u009e\u0005&\u0000\u0000\u009e\u009f\u0005"+
|
||||||
"\u0000\u0000\u0000\u00a1\u00a2\u0005<\u0000\u0000\u00a2\u00a3\u0005=\u0000"+
|
"&\u0000\u0000\u009f&\u0001\u0000\u0000\u0000\u00a0\u00a1\u0005|\u0000"+
|
||||||
"\u0000\u00a3.\u0001\u0000\u0000\u0000\u00a4\u00a5\u0005>\u0000\u0000\u00a5"+
|
"\u0000\u00a1\u00a2\u0005|\u0000\u0000\u00a2(\u0001\u0000\u0000\u0000\u00a3"+
|
||||||
"0\u0001\u0000\u0000\u0000\u00a6\u00a7\u0005>\u0000\u0000\u00a7\u00a8\u0005"+
|
"\u00a4\u0005=\u0000\u0000\u00a4\u00a5\u0005=\u0000\u0000\u00a5*\u0001"+
|
||||||
"=\u0000\u0000\u00a82\u0001\u0000\u0000\u0000\u00a9\u00aa\u0005+\u0000"+
|
"\u0000\u0000\u0000\u00a6\u00a7\u0005!\u0000\u0000\u00a7\u00a8\u0005=\u0000"+
|
||||||
"\u0000\u00aa4\u0001\u0000\u0000\u0000\u00ab\u00ac\u0005-\u0000\u0000\u00ac"+
|
"\u0000\u00a8,\u0001\u0000\u0000\u0000\u00a9\u00aa\u0005<\u0000\u0000\u00aa"+
|
||||||
"6\u0001\u0000\u0000\u0000\u00ad\u00ae\u0005*\u0000\u0000\u00ae8\u0001"+
|
".\u0001\u0000\u0000\u0000\u00ab\u00ac\u0005<\u0000\u0000\u00ac\u00ad\u0005"+
|
||||||
"\u0000\u0000\u0000\u00af\u00b0\u0005/\u0000\u0000\u00b0:\u0001\u0000\u0000"+
|
"=\u0000\u0000\u00ad0\u0001\u0000\u0000\u0000\u00ae\u00af\u0005>\u0000"+
|
||||||
"\u0000\u00b1\u00b2\u0005%\u0000\u0000\u00b2<\u0001\u0000\u0000\u0000\u00b3"+
|
"\u0000\u00af2\u0001\u0000\u0000\u0000\u00b0\u00b1\u0005>\u0000\u0000\u00b1"+
|
||||||
"\u00b4\u0005!\u0000\u0000\u00b4>\u0001\u0000\u0000\u0000\u00b5\u00b6\u0005"+
|
"\u00b2\u0005=\u0000\u0000\u00b24\u0001\u0000\u0000\u0000\u00b3\u00b4\u0005"+
|
||||||
"t\u0000\u0000\u00b6\u00b7\u0005r\u0000\u0000\u00b7\u00b8\u0005u\u0000"+
|
"+\u0000\u0000\u00b46\u0001\u0000\u0000\u0000\u00b5\u00b6\u0005-\u0000"+
|
||||||
"\u0000\u00b8\u00b9\u0005e\u0000\u0000\u00b9@\u0001\u0000\u0000\u0000\u00ba"+
|
"\u0000\u00b68\u0001\u0000\u0000\u0000\u00b7\u00b8\u0005*\u0000\u0000\u00b8"+
|
||||||
"\u00bb\u0005f\u0000\u0000\u00bb\u00bc\u0005a\u0000\u0000\u00bc\u00bd\u0005"+
|
":\u0001\u0000\u0000\u0000\u00b9\u00ba\u0005/\u0000\u0000\u00ba<\u0001"+
|
||||||
"l\u0000\u0000\u00bd\u00be\u0005s\u0000\u0000\u00be\u00bf\u0005e\u0000"+
|
"\u0000\u0000\u0000\u00bb\u00bc\u0005%\u0000\u0000\u00bc>\u0001\u0000\u0000"+
|
||||||
"\u0000\u00bfB\u0001\u0000\u0000\u0000\u00c0\u00c1\u0005\'\u0000\u0000"+
|
"\u0000\u00bd\u00be\u0005!\u0000\u0000\u00be@\u0001\u0000\u0000\u0000\u00bf"+
|
||||||
"\u00c1D\u0001\u0000\u0000\u0000\u00c2\u00c4\u0007\u0000\u0000\u0000\u00c3"+
|
"\u00c0\u0005t\u0000\u0000\u00c0\u00c1\u0005r\u0000\u0000\u00c1\u00c2\u0005"+
|
||||||
"\u00c2\u0001\u0000\u0000\u0000\u00c4\u00c5\u0001\u0000\u0000\u0000\u00c5"+
|
"u\u0000\u0000\u00c2\u00c3\u0005e\u0000\u0000\u00c3B\u0001\u0000\u0000"+
|
||||||
"\u00c3\u0001\u0000\u0000\u0000\u00c5\u00c6\u0001\u0000\u0000\u0000\u00c6"+
|
"\u0000\u00c4\u00c5\u0005f\u0000\u0000\u00c5\u00c6\u0005a\u0000\u0000\u00c6"+
|
||||||
"F\u0001\u0000\u0000\u0000\u00c7\u00cb\u0007\u0001\u0000\u0000\u00c8\u00ca"+
|
"\u00c7\u0005l\u0000\u0000\u00c7\u00c8\u0005s\u0000\u0000\u00c8\u00c9\u0005"+
|
||||||
"\u0007\u0002\u0000\u0000\u00c9\u00c8\u0001\u0000\u0000\u0000\u00ca\u00cd"+
|
"e\u0000\u0000\u00c9D\u0001\u0000\u0000\u0000\u00ca\u00cb\u0005\'\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u00cb\u00c9\u0001\u0000\u0000\u0000\u00cb\u00cc"+
|
"\u0000\u00cbF\u0001\u0000\u0000\u0000\u00cc\u00ce\u0007\u0000\u0000\u0000"+
|
||||||
"\u0001\u0000\u0000\u0000\u00ccH\u0001\u0000\u0000\u0000\u00cd\u00cb\u0001"+
|
"\u00cd\u00cc\u0001\u0000\u0000\u0000\u00ce\u00cf\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u00ce\u00d0\u0007\u0003\u0000\u0000\u00cf\u00ce\u0001"+
|
"\u00cf\u00cd\u0001\u0000\u0000\u0000\u00cf\u00d0\u0001\u0000\u0000\u0000"+
|
||||||
"\u0000\u0000\u0000\u00d0\u00d1\u0001\u0000\u0000\u0000\u00d1\u00cf\u0001"+
|
"\u00d0H\u0001\u0000\u0000\u0000\u00d1\u00d5\u0007\u0001\u0000\u0000\u00d2"+
|
||||||
"\u0000\u0000\u0000\u00d1\u00d2\u0001\u0000\u0000\u0000\u00d2\u00d3\u0001"+
|
"\u00d4\u0007\u0002\u0000\u0000\u00d3\u00d2\u0001\u0000\u0000\u0000\u00d4"+
|
||||||
"\u0000\u0000\u0000\u00d3\u00d4\u0006$\u0000\u0000\u00d4J\u0001\u0000\u0000"+
|
"\u00d7\u0001\u0000\u0000\u0000\u00d5\u00d3\u0001\u0000\u0000\u0000\u00d5"+
|
||||||
"\u0000\u0004\u0000\u00c5\u00cb\u00d1\u0001\u0006\u0000\u0000";
|
"\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";
|
||||||
public static final ATN _ATN =
|
public static final ATN _ATN =
|
||||||
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
|
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
|
||||||
static {
|
static {
|
||||||
|
@ -32,40 +32,42 @@ T__30=31
|
|||||||
T__31=32
|
T__31=32
|
||||||
T__32=33
|
T__32=33
|
||||||
T__33=34
|
T__33=34
|
||||||
INTEGERLITERAL=35
|
T__34=35
|
||||||
IDENTIFIER=36
|
INTEGERLITERAL=36
|
||||||
WS=37
|
IDENTIFIER=37
|
||||||
|
WS=38
|
||||||
'class'=1
|
'class'=1
|
||||||
'{'=2
|
'{'=2
|
||||||
'}'=3
|
'}'=3
|
||||||
';'=4
|
';'=4
|
||||||
'public'=5
|
'static'=5
|
||||||
'static'=6
|
'('=6
|
||||||
'('=7
|
')'=7
|
||||||
')'=8
|
','=8
|
||||||
','=9
|
'int'=9
|
||||||
'int'=10
|
'boolean'=10
|
||||||
'boolean'=11
|
'char'=11
|
||||||
'char'=12
|
'public'=12
|
||||||
'='=13
|
'private'=13
|
||||||
'if'=14
|
'='=14
|
||||||
'else'=15
|
'if'=15
|
||||||
'while'=16
|
'else'=16
|
||||||
'return'=17
|
'while'=17
|
||||||
'&&'=18
|
'return'=18
|
||||||
'||'=19
|
'&&'=19
|
||||||
'=='=20
|
'||'=20
|
||||||
'!='=21
|
'=='=21
|
||||||
'<'=22
|
'!='=22
|
||||||
'<='=23
|
'<'=23
|
||||||
'>'=24
|
'<='=24
|
||||||
'>='=25
|
'>'=25
|
||||||
'+'=26
|
'>='=26
|
||||||
'-'=27
|
'+'=27
|
||||||
'*'=28
|
'-'=28
|
||||||
'/'=29
|
'*'=29
|
||||||
'%'=30
|
'/'=30
|
||||||
'!'=31
|
'%'=31
|
||||||
'true'=32
|
'!'=32
|
||||||
'false'=33
|
'true'=33
|
||||||
'\''=34
|
'false'=34
|
||||||
|
'\''=35
|
||||||
|
@ -87,6 +87,16 @@ public interface SimpleJavaListener extends ParseTreeListener {
|
|||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
void exitType(SimpleJavaParser.TypeContext ctx);
|
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);
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by {@link SimpleJavaParser#statement}.
|
* Enter a parse tree produced by {@link SimpleJavaParser#statement}.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -58,6 +58,12 @@ public interface SimpleJavaVisitor<T> extends ParseTreeVisitor<T> {
|
|||||||
* @return the visitor result
|
* @return the visitor result
|
||||||
*/
|
*/
|
||||||
T visitType(SimpleJavaParser.TypeContext ctx);
|
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);
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by {@link SimpleJavaParser#statement}.
|
* Visit a parse tree produced by {@link SimpleJavaParser#statement}.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
import org.antlr.v4.runtime.CharStream;
|
|
||||||
import org.antlr.v4.runtime.CharStreams;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.antlr.v4.runtime.CharStream;
|
import org.antlr.v4.runtime.CharStream;
|
||||||
import org.antlr.v4.runtime.CharStreams;
|
import org.antlr.v4.runtime.CharStreams;
|
||||||
import org.antlr.v4.runtime.CommonTokenStream;
|
import org.antlr.v4.runtime.CommonTokenStream;
|
||||||
import org.antlr.v4.runtime.tree.ParseTree;
|
import org.antlr.v4.runtime.tree.ParseTree;
|
||||||
import parser.ASTBuilder;
|
import parser.ASTBuilder;
|
||||||
import parser.generated.SimpleJavaLexer;
|
|
||||||
import parser.generated.SimpleJavaParser;
|
|
||||||
import ast.ClassNode;
|
import ast.ClassNode;
|
||||||
import ast.ProgramNode;
|
import ast.ProgramNode;
|
||||||
import bytecode.ByteCodeGenerator;
|
import bytecode.ByteCodeGenerator;
|
||||||
|
Loading…
Reference in New Issue
Block a user