Homework 2
This commit is contained in:
parent
12f678a924
commit
bf60a078d7
64 changed files with 4786 additions and 1185 deletions
6
src/cd/frontend/parser/.gitignore
vendored
6
src/cd/frontend/parser/.gitignore
vendored
|
@ -1,6 +0,0 @@
|
|||
/Javali.tokens
|
||||
/JavaliBaseVisitor.java
|
||||
/JavaliLexer.java
|
||||
/JavaliLexer.tokens
|
||||
/JavaliParser.java
|
||||
/JavaliVisitor.java
|
203
src/cd/frontend/parser/Javali.g4
Normal file
203
src/cd/frontend/parser/Javali.g4
Normal file
|
@ -0,0 +1,203 @@
|
|||
grammar Javali; // parser grammar, parses streams of tokens
|
||||
|
||||
@header {
|
||||
// Java header
|
||||
package cd.frontend.parser;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// PARSER RULES
|
||||
literal
|
||||
: 'null' # NullLiteral
|
||||
| Boolean # BoolLiteral
|
||||
| Integer # IntLiteral
|
||||
;
|
||||
|
||||
// Types
|
||||
type
|
||||
: primitiveType
|
||||
| referenceType
|
||||
;
|
||||
|
||||
referenceType
|
||||
: Ident
|
||||
| arrayType
|
||||
;
|
||||
|
||||
arrayType
|
||||
: Ident '[' ']'
|
||||
| primitiveType '[' ']'
|
||||
;
|
||||
|
||||
primitiveType
|
||||
: 'boolean'
|
||||
| 'int'
|
||||
;
|
||||
|
||||
// Program structure
|
||||
unit
|
||||
: classDecl+ EOF
|
||||
;
|
||||
|
||||
classDecl
|
||||
: 'class' Ident ('extends' Ident)? '{' memberList '}'
|
||||
;
|
||||
|
||||
memberList
|
||||
: (varDecl | methodDecl)*
|
||||
;
|
||||
|
||||
varDecl
|
||||
: type Ident (',' Ident)* ';'
|
||||
;
|
||||
|
||||
methodDecl
|
||||
: (type | 'void') Ident '(' formalParamList? ')' '{' varDecl* stmt* '}'
|
||||
;
|
||||
|
||||
formalParamList
|
||||
: type Ident (',' type Ident)*
|
||||
;
|
||||
|
||||
// Statements
|
||||
stmt
|
||||
: assignmentStmt
|
||||
| methodCallStmt
|
||||
| ifStmt
|
||||
| whileStmt
|
||||
| returnStmt
|
||||
| writeStmt
|
||||
;
|
||||
|
||||
stmtBlock
|
||||
: '{' stmt* '}'
|
||||
;
|
||||
|
||||
methodCallStmt
|
||||
: Ident '(' actualParamList? ')' ';' # LocalMethodCallStmt
|
||||
| identAccess '.' Ident '(' actualParamList? ')' ';' # ObjectMethodCallStmt
|
||||
;
|
||||
|
||||
assignmentStmt
|
||||
: identAccess '=' (expr | newExpr | readExpr) ';'
|
||||
;
|
||||
|
||||
writeStmt
|
||||
: 'write' '(' expr ')' ';' # Write
|
||||
| 'writeln' '(' ')' ';' # WriteLn
|
||||
;
|
||||
|
||||
ifStmt
|
||||
: 'if' '(' expr ')' stmtBlock ('else' stmtBlock)?
|
||||
;
|
||||
|
||||
whileStmt
|
||||
: 'while' '(' expr ')' stmtBlock
|
||||
;
|
||||
|
||||
returnStmt
|
||||
: 'return' expr? ';'
|
||||
;
|
||||
|
||||
// Expressions
|
||||
newExpr
|
||||
: 'new' Ident '(' ')' # NewObject
|
||||
| 'new' Ident '[' expr ']' # NewObjectArray
|
||||
| 'new' primitiveType '[' expr ']' # NewPrimitiveArray
|
||||
;
|
||||
|
||||
readExpr
|
||||
: 'read' '(' ')'
|
||||
;
|
||||
|
||||
actualParamList
|
||||
: expr (',' expr)*
|
||||
;
|
||||
|
||||
identAccess
|
||||
: Ident # AccessLocalField
|
||||
| 'this' # AccessThis
|
||||
| identAccess '.' Ident # AccessObjectField
|
||||
| identAccess '[' expr ']' # AccessArray
|
||||
| Ident '(' actualParamList? ')' # AccessLocalMethod
|
||||
| identAccess '.' Ident '(' actualParamList? ')'# AccessObjectMethod
|
||||
;
|
||||
|
||||
expr
|
||||
: literal # ExprConstant
|
||||
| identAccess # ExprIdentAccess
|
||||
| '(' expr ')' # ExprParentheses
|
||||
| ('+'|'-'|'!') expr # ExprUnary
|
||||
| '(' referenceType ')' expr # ExprCast
|
||||
| expr ('*'|'/'|'%') expr # ExprBinary
|
||||
| expr ('+'|'-') expr # ExprBinary
|
||||
| expr ('<'|'>'|'<='|'>=') expr # ExprBinary
|
||||
| expr ('=='|'!=') expr # ExprBinary
|
||||
| expr '&&' expr # ExprBinary
|
||||
| expr '||' expr # ExprBinary
|
||||
;
|
||||
|
||||
|
||||
// LEXER RULES
|
||||
fragment
|
||||
Letter
|
||||
: 'A'..'Z'
|
||||
| 'a'..'z'
|
||||
;
|
||||
|
||||
fragment
|
||||
Digit
|
||||
: '0'..'9'
|
||||
;
|
||||
|
||||
fragment
|
||||
HexDigit
|
||||
: Digit
|
||||
| 'a'..'f'
|
||||
| 'A'..'F'
|
||||
;
|
||||
|
||||
fragment
|
||||
Decimal
|
||||
: '0'
|
||||
| '1'..'9' Digit*
|
||||
;
|
||||
|
||||
fragment
|
||||
Hexadecimal
|
||||
: ('0x'|'0X') HexDigit+
|
||||
;
|
||||
|
||||
Integer
|
||||
: Decimal
|
||||
| Hexadecimal
|
||||
;
|
||||
|
||||
Boolean
|
||||
: 'false'
|
||||
| 'true'
|
||||
;
|
||||
|
||||
Ident
|
||||
: Letter (Letter|Digit)*
|
||||
;
|
||||
|
||||
|
||||
|
||||
// comments and white space does not produce tokens:
|
||||
COMMENT
|
||||
: '/*' .*? '*/' -> skip
|
||||
;
|
||||
|
||||
LINE_COMMENT
|
||||
: '//' ~('\n'|'\r')* -> skip
|
||||
;
|
||||
|
||||
WS
|
||||
: (' '|'\r'|'\t'|'\n') -> skip
|
||||
;
|
||||
|
||||
|
||||
// handle characters which failed to match any other token
|
||||
ErrorCharacter : . ;
|
127
src/cd/frontend/parser/Javali.interp
Normal file
127
src/cd/frontend/parser/Javali.interp
Normal file
File diff suppressed because one or more lines are too long
85
src/cd/frontend/parser/Javali.tokens
Normal file
85
src/cd/frontend/parser/Javali.tokens
Normal file
|
@ -0,0 +1,85 @@
|
|||
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
|
||||
T__35=36
|
||||
T__36=37
|
||||
T__37=38
|
||||
T__38=39
|
||||
Integer=40
|
||||
Boolean=41
|
||||
Ident=42
|
||||
COMMENT=43
|
||||
LINE_COMMENT=44
|
||||
WS=45
|
||||
ErrorCharacter=46
|
||||
'null'=1
|
||||
'['=2
|
||||
']'=3
|
||||
'boolean'=4
|
||||
'int'=5
|
||||
'class'=6
|
||||
'extends'=7
|
||||
'{'=8
|
||||
'}'=9
|
||||
','=10
|
||||
';'=11
|
||||
'void'=12
|
||||
'('=13
|
||||
')'=14
|
||||
'.'=15
|
||||
'='=16
|
||||
'write'=17
|
||||
'writeln'=18
|
||||
'if'=19
|
||||
'else'=20
|
||||
'while'=21
|
||||
'return'=22
|
||||
'new'=23
|
||||
'read'=24
|
||||
'this'=25
|
||||
'+'=26
|
||||
'-'=27
|
||||
'!'=28
|
||||
'*'=29
|
||||
'/'=30
|
||||
'%'=31
|
||||
'<'=32
|
||||
'>'=33
|
||||
'<='=34
|
||||
'>='=35
|
||||
'=='=36
|
||||
'!='=37
|
||||
'&&'=38
|
||||
'||'=39
|
329
src/cd/frontend/parser/JavaliAstVisitor.java
Normal file
329
src/cd/frontend/parser/JavaliAstVisitor.java
Normal file
|
@ -0,0 +1,329 @@
|
|||
package cd.frontend.parser;
|
||||
|
||||
import cd.frontend.parser.JavaliParser.*;
|
||||
import cd.ir.Ast;
|
||||
import cd.ir.Ast.*;
|
||||
import cd.ir.Ast.BinaryOp.BOp;
|
||||
import cd.ir.Ast.UnaryOp.UOp;
|
||||
import org.antlr.v4.runtime.tree.ParseTree;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class JavaliAstVisitor extends JavaliBaseVisitor<Ast> {
|
||||
|
||||
public List<ClassDecl> classDecls = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public Ast visitUnit(UnitContext ctx) {
|
||||
for (ClassDeclContext classDeclContext : ctx.classDecl())
|
||||
classDecls.add((ClassDecl) visit(classDeclContext));
|
||||
return new Seq(new ArrayList<>(classDecls));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitClassDecl(ClassDeclContext ctx) {
|
||||
String name = ctx.Ident(0).getText();
|
||||
String superClass = "Object"; // Common superclass
|
||||
if (ctx.Ident().size() == 2)
|
||||
superClass = ctx.Ident(1).getText();
|
||||
Seq members = (Seq) visit(ctx.memberList());
|
||||
return new ClassDecl(name, superClass, members.children());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitMemberList(MemberListContext ctx) {
|
||||
if (ctx.children == null) {
|
||||
return new Seq(new ArrayList<>());
|
||||
}
|
||||
List<Ast> list = new ArrayList<>(ctx.children.size());
|
||||
for (ParseTree parseTree : ctx.children) {
|
||||
if (parseTree instanceof VarDeclContext) {
|
||||
Seq seqVars = (Seq) visit(parseTree);
|
||||
list.addAll(seqVars.children());
|
||||
} else {
|
||||
assert parseTree instanceof MethodDeclContext;
|
||||
list.add(visit(parseTree));
|
||||
}
|
||||
}
|
||||
return new Seq(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitVarDecl(VarDeclContext ctx) {
|
||||
List<Ast> list = new ArrayList<>(ctx.Ident().size());
|
||||
String type = ctx.type().getText();
|
||||
for (TerminalNode n : ctx.Ident())
|
||||
list.add(new VarDecl(type, n.getText()));
|
||||
return new Seq(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitMethodDecl(MethodDeclContext ctx) {
|
||||
List<String> argumentTypes = new ArrayList<>();
|
||||
List<String> argumentNames = new ArrayList<>();
|
||||
if (ctx.formalParamList() != null) {
|
||||
Seq paramList = (Seq) visit(ctx.formalParamList());
|
||||
for (Ast ast : paramList.children()) {
|
||||
VarDecl var = (VarDecl) ast;
|
||||
argumentNames.add(var.name);
|
||||
argumentTypes.add(var.type);
|
||||
}
|
||||
}
|
||||
|
||||
List<Ast> decls = new ArrayList<>(ctx.varDecl().size());
|
||||
for (VarDeclContext varDecl : ctx.varDecl()) {
|
||||
Seq declarationSeq = (Seq) visit(varDecl);
|
||||
decls.addAll(declarationSeq.children());
|
||||
}
|
||||
|
||||
List<Ast> stmts = new ArrayList<>(ctx.stmt().size());
|
||||
for (StmtContext s : ctx.stmt())
|
||||
stmts.add(visit(s));
|
||||
|
||||
return new MethodDecl(
|
||||
ctx.type() == null ? "void" : ctx.type().getText(),
|
||||
ctx.Ident().getText(),
|
||||
argumentTypes,
|
||||
argumentNames,
|
||||
new Seq(decls),
|
||||
new Seq(stmts)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitFormalParamList(FormalParamListContext ctx) {
|
||||
List<Ast> list = new ArrayList<>(ctx.type().size());
|
||||
for (int i = 0; i < ctx.type().size(); i++) {
|
||||
String type = ctx.type(i).getText();
|
||||
String name = ctx.Ident(i).getText();
|
||||
list.add(new VarDecl(type, name));
|
||||
}
|
||||
return new Seq(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitStmt(StmtContext ctx) {
|
||||
return visit(ctx.children.get(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitStmtBlock(StmtBlockContext ctx) {
|
||||
List<Ast> list = new ArrayList<>(ctx.stmt().size());
|
||||
for (StmtContext stmtContext : ctx.stmt())
|
||||
list.add(visit(stmtContext));
|
||||
return new Seq(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitLocalMethodCallStmt(LocalMethodCallStmtContext ctx) {
|
||||
return new MethodCall(new MethodCallExpr(
|
||||
new ThisRef(),
|
||||
ctx.Ident().getText(),
|
||||
getParams(ctx.actualParamList())
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitObjectMethodCallStmt(ObjectMethodCallStmtContext ctx) {
|
||||
return new MethodCall(new MethodCallExpr(
|
||||
(Expr) visit(ctx.identAccess()),
|
||||
ctx.Ident().getText(),
|
||||
getParams(ctx.actualParamList())
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitAssignmentStmt(AssignmentStmtContext ctx) {
|
||||
Expr left = (Expr) visit(ctx.children.get(0));
|
||||
Expr right = (Expr) visit(ctx.children.get(2));
|
||||
return new Assign(left, right);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitWrite(WriteContext ctx) {
|
||||
return new BuiltInWrite((Expr) visit(ctx.expr()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitWriteLn(WriteLnContext ctx) {
|
||||
return new BuiltInWriteln();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitIfStmt(IfStmtContext ctx) {
|
||||
Expr condition = (Expr) visit(ctx.expr());
|
||||
Ast then = visit(ctx.stmtBlock(0));
|
||||
Ast otherwise = new Nop();
|
||||
if (ctx.stmtBlock().size() == 2)
|
||||
otherwise = visit(ctx.stmtBlock(1));
|
||||
return new IfElse(condition, then, otherwise);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitWhileStmt(WhileStmtContext ctx) {
|
||||
Expr condition = (Expr) visit(ctx.expr());
|
||||
Ast body = visit(ctx.stmtBlock());
|
||||
return new WhileLoop(condition, body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitReturnStmt(ReturnStmtContext ctx) {
|
||||
if (ctx.expr() != null)
|
||||
return new ReturnStmt((Expr) visit(ctx.expr()));
|
||||
else
|
||||
return new ReturnStmt(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitNewObject(NewObjectContext ctx) {
|
||||
return new NewObject(ctx.Ident().getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitNewObjectArray(NewObjectArrayContext ctx) {
|
||||
String type = ctx.Ident().getText();
|
||||
Expr size = (Expr) visit(ctx.expr());
|
||||
return new NewArray(type + "[]", size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitNewPrimitiveArray(NewPrimitiveArrayContext ctx) {
|
||||
String type = ctx.primitiveType().getText();
|
||||
Expr size = (Expr) visit(ctx.expr());
|
||||
return new NewArray(type + "[]", size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitReadExpr(ReadExprContext ctx) {
|
||||
return new BuiltInRead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitActualParamList(ActualParamListContext ctx) {
|
||||
List<Ast> list = new ArrayList<>(ctx.expr().size());
|
||||
for (ExprContext exprContext : ctx.expr())
|
||||
list.add(visit(exprContext));
|
||||
return new Seq(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitAccessThis(AccessThisContext ctx) {
|
||||
return new ThisRef();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitAccessLocalField(AccessLocalFieldContext ctx) {
|
||||
return new Var(ctx.Ident().getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitAccessObjectField(AccessObjectFieldContext ctx) {
|
||||
Expr arg = (Expr) visit(ctx.identAccess());
|
||||
String fieldName = ctx.Ident().getText();
|
||||
return new Field(arg, fieldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitAccessLocalMethod(AccessLocalMethodContext ctx) {
|
||||
return new MethodCallExpr(
|
||||
new ThisRef(),
|
||||
ctx.Ident().getText(),
|
||||
getParams(ctx.actualParamList())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitAccessArray(AccessArrayContext ctx) {
|
||||
Expr array = (Expr) visit(ctx.identAccess());
|
||||
Expr index = (Expr) visit(ctx.expr());
|
||||
return new Index(array, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitAccessObjectMethod(AccessObjectMethodContext ctx) {
|
||||
return new MethodCallExpr(
|
||||
(Expr) visit(ctx.identAccess()),
|
||||
ctx.Ident().getText(),
|
||||
getParams(ctx.actualParamList())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitExprBinary(ExprBinaryContext ctx) {
|
||||
Expr left = (Expr) visit(ctx.expr(0));
|
||||
Expr right = (Expr) visit(ctx.expr(1));
|
||||
String op = ctx.getChild(1).getText();
|
||||
for (BOp bop : BOp.values())
|
||||
if (bop.repr.equals(op))
|
||||
return new BinaryOp(left, bop, right);
|
||||
throw new RuntimeException("BOp enum is inconsistent with grammar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitExprCast(ExprCastContext ctx) {
|
||||
Expr arg = (Expr) visit(ctx.expr());
|
||||
String typeName = ctx.referenceType().getText();
|
||||
return new Cast(arg, typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitExprParentheses(ExprParenthesesContext ctx) {
|
||||
return visit(ctx.expr());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitExprUnary(ExprUnaryContext ctx) {
|
||||
Expr expr = (Expr) visit(ctx.expr());
|
||||
String op = ctx.getChild(0).getText();
|
||||
for (UOp uop : UOp.values())
|
||||
if (uop.repr.equals(op))
|
||||
return new UnaryOp(uop, expr);
|
||||
throw new RuntimeException("UOp enum is inconsistent with grammar");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitExprConstant(ExprConstantContext ctx) {
|
||||
return visit(ctx.literal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitNullLiteral(NullLiteralContext ctx) {
|
||||
return new NullConst();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitBoolLiteral(BoolLiteralContext ctx) {
|
||||
return new BooleanConst(ctx.Boolean().getText().equals("true"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitIntLiteral(IntLiteralContext ctx) {
|
||||
try {
|
||||
return new IntConst(Integer.decode(ctx.Integer().getText()));
|
||||
} catch (NumberFormatException exception) {
|
||||
throw new ParseFailure(ctx.start.getLine(), "Value not in 32bit signed int range");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ast visitExprIdentAccess(ExprIdentAccessContext ctx) {
|
||||
return visit(ctx.identAccess());
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain the parameters for a method call
|
||||
* @param paramListContext Formal parameter list from the ANTRL tree
|
||||
* @return List of parameters for the method call
|
||||
*/
|
||||
private List<Expr> getParams(ActualParamListContext paramListContext) {
|
||||
List<Expr> paramList = new ArrayList<>();
|
||||
if (paramListContext != null) {
|
||||
Seq paramSeq = (Seq) visit(paramListContext);
|
||||
for (Ast ast : paramSeq.children())
|
||||
paramList.add((Expr) ast);
|
||||
}
|
||||
return paramList;
|
||||
}
|
||||
}
|
297
src/cd/frontend/parser/JavaliBaseVisitor.java
Normal file
297
src/cd/frontend/parser/JavaliBaseVisitor.java
Normal file
|
@ -0,0 +1,297 @@
|
|||
// Generated from /home/carlos/eth/cd/nop90/HW2/src/cd/frontend/parser/Javali.g4 by ANTLR 4.7.1
|
||||
|
||||
// Java header
|
||||
package cd.frontend.parser;
|
||||
|
||||
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;
|
||||
|
||||
/**
|
||||
* This class provides an empty implementation of {@link JavaliVisitor},
|
||||
* which can be extended to create a visitor which only needs to handle a subset
|
||||
* of the available methods.
|
||||
*
|
||||
* @param <T> The return type of the visit operation. Use {@link Void} for
|
||||
* operations with no return type.
|
||||
*/
|
||||
public class JavaliBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements JavaliVisitor<T> {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitNullLiteral(JavaliParser.NullLiteralContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitBoolLiteral(JavaliParser.BoolLiteralContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitIntLiteral(JavaliParser.IntLiteralContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitType(JavaliParser.TypeContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitReferenceType(JavaliParser.ReferenceTypeContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitArrayType(JavaliParser.ArrayTypeContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitPrimitiveType(JavaliParser.PrimitiveTypeContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitUnit(JavaliParser.UnitContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitClassDecl(JavaliParser.ClassDeclContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitMemberList(JavaliParser.MemberListContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitVarDecl(JavaliParser.VarDeclContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitMethodDecl(JavaliParser.MethodDeclContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitFormalParamList(JavaliParser.FormalParamListContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitStmt(JavaliParser.StmtContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitStmtBlock(JavaliParser.StmtBlockContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitLocalMethodCallStmt(JavaliParser.LocalMethodCallStmtContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitObjectMethodCallStmt(JavaliParser.ObjectMethodCallStmtContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitAssignmentStmt(JavaliParser.AssignmentStmtContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitWrite(JavaliParser.WriteContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitWriteLn(JavaliParser.WriteLnContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitIfStmt(JavaliParser.IfStmtContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitWhileStmt(JavaliParser.WhileStmtContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitReturnStmt(JavaliParser.ReturnStmtContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitNewObject(JavaliParser.NewObjectContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitNewObjectArray(JavaliParser.NewObjectArrayContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitNewPrimitiveArray(JavaliParser.NewPrimitiveArrayContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitReadExpr(JavaliParser.ReadExprContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitActualParamList(JavaliParser.ActualParamListContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitAccessThis(JavaliParser.AccessThisContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitAccessLocalField(JavaliParser.AccessLocalFieldContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitAccessObjectField(JavaliParser.AccessObjectFieldContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitAccessLocalMethod(JavaliParser.AccessLocalMethodContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitAccessArray(JavaliParser.AccessArrayContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitAccessObjectMethod(JavaliParser.AccessObjectMethodContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprBinary(JavaliParser.ExprBinaryContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprCast(JavaliParser.ExprCastContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprParentheses(JavaliParser.ExprParenthesesContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprUnary(JavaliParser.ExprUnaryContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprConstant(JavaliParser.ExprConstantContext ctx) { return visitChildren(ctx); }
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* <p>The default implementation returns the result of calling
|
||||
* {@link #visitChildren} on {@code ctx}.</p>
|
||||
*/
|
||||
@Override public T visitExprIdentAccess(JavaliParser.ExprIdentAccessContext ctx) { return visitChildren(ctx); }
|
||||
}
|
160
src/cd/frontend/parser/JavaliLexer.interp
Normal file
160
src/cd/frontend/parser/JavaliLexer.interp
Normal file
File diff suppressed because one or more lines are too long
232
src/cd/frontend/parser/JavaliLexer.java
Normal file
232
src/cd/frontend/parser/JavaliLexer.java
Normal file
|
@ -0,0 +1,232 @@
|
|||
// Generated from /home/carlos/eth/cd/nop90/HW2/src/cd/frontend/parser/Javali.g4 by ANTLR 4.7.1
|
||||
|
||||
// Java header
|
||||
package cd.frontend.parser;
|
||||
|
||||
import org.antlr.v4.runtime.Lexer;
|
||||
import org.antlr.v4.runtime.CharStream;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.TokenStream;
|
||||
import org.antlr.v4.runtime.*;
|
||||
import org.antlr.v4.runtime.atn.*;
|
||||
import org.antlr.v4.runtime.dfa.DFA;
|
||||
import org.antlr.v4.runtime.misc.*;
|
||||
|
||||
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
|
||||
public class JavaliLexer extends Lexer {
|
||||
static { RuntimeMetaData.checkVersion("4.7.1", RuntimeMetaData.VERSION); }
|
||||
|
||||
protected static final DFA[] _decisionToDFA;
|
||||
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, T__35=36, T__36=37, T__37=38,
|
||||
T__38=39, Integer=40, Boolean=41, Ident=42, COMMENT=43, LINE_COMMENT=44,
|
||||
WS=45, ErrorCharacter=46;
|
||||
public static String[] channelNames = {
|
||||
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
|
||||
};
|
||||
|
||||
public static String[] modeNames = {
|
||||
"DEFAULT_MODE"
|
||||
};
|
||||
|
||||
public static final String[] ruleNames = {
|
||||
"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", "T__35", "T__36", "T__37", "T__38", "Letter", "Digit",
|
||||
"HexDigit", "Decimal", "Hexadecimal", "Integer", "Boolean", "Ident", "COMMENT",
|
||||
"LINE_COMMENT", "WS", "ErrorCharacter"
|
||||
};
|
||||
|
||||
private static final String[] _LITERAL_NAMES = {
|
||||
null, "'null'", "'['", "']'", "'boolean'", "'int'", "'class'", "'extends'",
|
||||
"'{'", "'}'", "','", "';'", "'void'", "'('", "')'", "'.'", "'='", "'write'",
|
||||
"'writeln'", "'if'", "'else'", "'while'", "'return'", "'new'", "'read'",
|
||||
"'this'", "'+'", "'-'", "'!'", "'*'", "'/'", "'%'", "'<'", "'>'", "'<='",
|
||||
"'>='", "'=='", "'!='", "'&&'", "'||'"
|
||||
};
|
||||
private static final String[] _SYMBOLIC_NAMES = {
|
||||
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, "Integer", "Boolean", "Ident", "COMMENT", "LINE_COMMENT",
|
||||
"WS", "ErrorCharacter"
|
||||
};
|
||||
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #VOCABULARY} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String[] tokenNames;
|
||||
static {
|
||||
tokenNames = new String[_SYMBOLIC_NAMES.length];
|
||||
for (int i = 0; i < tokenNames.length; i++) {
|
||||
tokenNames[i] = VOCABULARY.getLiteralName(i);
|
||||
if (tokenNames[i] == null) {
|
||||
tokenNames[i] = VOCABULARY.getSymbolicName(i);
|
||||
}
|
||||
|
||||
if (tokenNames[i] == null) {
|
||||
tokenNames[i] = "<INVALID>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String[] getTokenNames() {
|
||||
return tokenNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public Vocabulary getVocabulary() {
|
||||
return VOCABULARY;
|
||||
}
|
||||
|
||||
|
||||
public JavaliLexer(CharStream input) {
|
||||
super(input);
|
||||
_interp = new LexerATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGrammarFileName() { return "Javali.g4"; }
|
||||
|
||||
@Override
|
||||
public String[] getRuleNames() { return ruleNames; }
|
||||
|
||||
@Override
|
||||
public String getSerializedATN() { return _serializedATN; }
|
||||
|
||||
@Override
|
||||
public String[] getChannelNames() { return channelNames; }
|
||||
|
||||
@Override
|
||||
public String[] getModeNames() { return modeNames; }
|
||||
|
||||
@Override
|
||||
public ATN getATN() { return _ATN; }
|
||||
|
||||
public static final String _serializedATN =
|
||||
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\60\u0147\b\1\4\2"+
|
||||
"\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4"+
|
||||
"\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22"+
|
||||
"\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31"+
|
||||
"\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t"+
|
||||
" \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t"+
|
||||
"+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64"+
|
||||
"\t\64\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\4\3\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5"+
|
||||
"\3\5\3\6\3\6\3\6\3\6\3\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\b\3\b\3\b\3"+
|
||||
"\b\3\b\3\t\3\t\3\n\3\n\3\13\3\13\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\16\3\16"+
|
||||
"\3\17\3\17\3\20\3\20\3\21\3\21\3\22\3\22\3\22\3\22\3\22\3\22\3\23\3\23"+
|
||||
"\3\23\3\23\3\23\3\23\3\23\3\23\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\25"+
|
||||
"\3\26\3\26\3\26\3\26\3\26\3\26\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\30"+
|
||||
"\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\32\3\32\3\32\3\32\3\32\3\33"+
|
||||
"\3\33\3\34\3\34\3\35\3\35\3\36\3\36\3\37\3\37\3 \3 \3!\3!\3\"\3\"\3#\3"+
|
||||
"#\3#\3$\3$\3$\3%\3%\3%\3&\3&\3&\3\'\3\'\3\'\3(\3(\3(\3)\3)\3*\3*\3+\3"+
|
||||
"+\5+\u00fb\n+\3,\3,\3,\7,\u0100\n,\f,\16,\u0103\13,\5,\u0105\n,\3-\3-"+
|
||||
"\3-\3-\5-\u010b\n-\3-\6-\u010e\n-\r-\16-\u010f\3.\3.\5.\u0114\n.\3/\3"+
|
||||
"/\3/\3/\3/\3/\3/\3/\3/\5/\u011f\n/\3\60\3\60\3\60\7\60\u0124\n\60\f\60"+
|
||||
"\16\60\u0127\13\60\3\61\3\61\3\61\3\61\7\61\u012d\n\61\f\61\16\61\u0130"+
|
||||
"\13\61\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62\3\62\7\62\u013b\n\62\f"+
|
||||
"\62\16\62\u013e\13\62\3\62\3\62\3\63\3\63\3\63\3\63\3\64\3\64\3\u012e"+
|
||||
"\2\65\3\3\5\4\7\5\t\6\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35"+
|
||||
"\20\37\21!\22#\23%\24\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36"+
|
||||
";\37= ?!A\"C#E$G%I&K\'M(O)Q\2S\2U\2W\2Y\2[*]+_,a-c.e/g\60\3\2\6\4\2C\\"+
|
||||
"c|\4\2CHch\4\2\f\f\17\17\5\2\13\f\17\17\"\"\2\u014c\2\3\3\2\2\2\2\5\3"+
|
||||
"\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2\2\2\2"+
|
||||
"\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2\2\33\3"+
|
||||
"\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2\2\2\'"+
|
||||
"\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2\2\2\63"+
|
||||
"\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2\2\2\2"+
|
||||
"?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2\2K\3"+
|
||||
"\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2"+
|
||||
"\2\2c\3\2\2\2\2e\3\2\2\2\2g\3\2\2\2\3i\3\2\2\2\5n\3\2\2\2\7p\3\2\2\2\t"+
|
||||
"r\3\2\2\2\13z\3\2\2\2\r~\3\2\2\2\17\u0084\3\2\2\2\21\u008c\3\2\2\2\23"+
|
||||
"\u008e\3\2\2\2\25\u0090\3\2\2\2\27\u0092\3\2\2\2\31\u0094\3\2\2\2\33\u0099"+
|
||||
"\3\2\2\2\35\u009b\3\2\2\2\37\u009d\3\2\2\2!\u009f\3\2\2\2#\u00a1\3\2\2"+
|
||||
"\2%\u00a7\3\2\2\2\'\u00af\3\2\2\2)\u00b2\3\2\2\2+\u00b7\3\2\2\2-\u00bd"+
|
||||
"\3\2\2\2/\u00c4\3\2\2\2\61\u00c8\3\2\2\2\63\u00cd\3\2\2\2\65\u00d2\3\2"+
|
||||
"\2\2\67\u00d4\3\2\2\29\u00d6\3\2\2\2;\u00d8\3\2\2\2=\u00da\3\2\2\2?\u00dc"+
|
||||
"\3\2\2\2A\u00de\3\2\2\2C\u00e0\3\2\2\2E\u00e2\3\2\2\2G\u00e5\3\2\2\2I"+
|
||||
"\u00e8\3\2\2\2K\u00eb\3\2\2\2M\u00ee\3\2\2\2O\u00f1\3\2\2\2Q\u00f4\3\2"+
|
||||
"\2\2S\u00f6\3\2\2\2U\u00fa\3\2\2\2W\u0104\3\2\2\2Y\u010a\3\2\2\2[\u0113"+
|
||||
"\3\2\2\2]\u011e\3\2\2\2_\u0120\3\2\2\2a\u0128\3\2\2\2c\u0136\3\2\2\2e"+
|
||||
"\u0141\3\2\2\2g\u0145\3\2\2\2ij\7p\2\2jk\7w\2\2kl\7n\2\2lm\7n\2\2m\4\3"+
|
||||
"\2\2\2no\7]\2\2o\6\3\2\2\2pq\7_\2\2q\b\3\2\2\2rs\7d\2\2st\7q\2\2tu\7q"+
|
||||
"\2\2uv\7n\2\2vw\7g\2\2wx\7c\2\2xy\7p\2\2y\n\3\2\2\2z{\7k\2\2{|\7p\2\2"+
|
||||
"|}\7v\2\2}\f\3\2\2\2~\177\7e\2\2\177\u0080\7n\2\2\u0080\u0081\7c\2\2\u0081"+
|
||||
"\u0082\7u\2\2\u0082\u0083\7u\2\2\u0083\16\3\2\2\2\u0084\u0085\7g\2\2\u0085"+
|
||||
"\u0086\7z\2\2\u0086\u0087\7v\2\2\u0087\u0088\7g\2\2\u0088\u0089\7p\2\2"+
|
||||
"\u0089\u008a\7f\2\2\u008a\u008b\7u\2\2\u008b\20\3\2\2\2\u008c\u008d\7"+
|
||||
"}\2\2\u008d\22\3\2\2\2\u008e\u008f\7\177\2\2\u008f\24\3\2\2\2\u0090\u0091"+
|
||||
"\7.\2\2\u0091\26\3\2\2\2\u0092\u0093\7=\2\2\u0093\30\3\2\2\2\u0094\u0095"+
|
||||
"\7x\2\2\u0095\u0096\7q\2\2\u0096\u0097\7k\2\2\u0097\u0098\7f\2\2\u0098"+
|
||||
"\32\3\2\2\2\u0099\u009a\7*\2\2\u009a\34\3\2\2\2\u009b\u009c\7+\2\2\u009c"+
|
||||
"\36\3\2\2\2\u009d\u009e\7\60\2\2\u009e \3\2\2\2\u009f\u00a0\7?\2\2\u00a0"+
|
||||
"\"\3\2\2\2\u00a1\u00a2\7y\2\2\u00a2\u00a3\7t\2\2\u00a3\u00a4\7k\2\2\u00a4"+
|
||||
"\u00a5\7v\2\2\u00a5\u00a6\7g\2\2\u00a6$\3\2\2\2\u00a7\u00a8\7y\2\2\u00a8"+
|
||||
"\u00a9\7t\2\2\u00a9\u00aa\7k\2\2\u00aa\u00ab\7v\2\2\u00ab\u00ac\7g\2\2"+
|
||||
"\u00ac\u00ad\7n\2\2\u00ad\u00ae\7p\2\2\u00ae&\3\2\2\2\u00af\u00b0\7k\2"+
|
||||
"\2\u00b0\u00b1\7h\2\2\u00b1(\3\2\2\2\u00b2\u00b3\7g\2\2\u00b3\u00b4\7"+
|
||||
"n\2\2\u00b4\u00b5\7u\2\2\u00b5\u00b6\7g\2\2\u00b6*\3\2\2\2\u00b7\u00b8"+
|
||||
"\7y\2\2\u00b8\u00b9\7j\2\2\u00b9\u00ba\7k\2\2\u00ba\u00bb\7n\2\2\u00bb"+
|
||||
"\u00bc\7g\2\2\u00bc,\3\2\2\2\u00bd\u00be\7t\2\2\u00be\u00bf\7g\2\2\u00bf"+
|
||||
"\u00c0\7v\2\2\u00c0\u00c1\7w\2\2\u00c1\u00c2\7t\2\2\u00c2\u00c3\7p\2\2"+
|
||||
"\u00c3.\3\2\2\2\u00c4\u00c5\7p\2\2\u00c5\u00c6\7g\2\2\u00c6\u00c7\7y\2"+
|
||||
"\2\u00c7\60\3\2\2\2\u00c8\u00c9\7t\2\2\u00c9\u00ca\7g\2\2\u00ca\u00cb"+
|
||||
"\7c\2\2\u00cb\u00cc\7f\2\2\u00cc\62\3\2\2\2\u00cd\u00ce\7v\2\2\u00ce\u00cf"+
|
||||
"\7j\2\2\u00cf\u00d0\7k\2\2\u00d0\u00d1\7u\2\2\u00d1\64\3\2\2\2\u00d2\u00d3"+
|
||||
"\7-\2\2\u00d3\66\3\2\2\2\u00d4\u00d5\7/\2\2\u00d58\3\2\2\2\u00d6\u00d7"+
|
||||
"\7#\2\2\u00d7:\3\2\2\2\u00d8\u00d9\7,\2\2\u00d9<\3\2\2\2\u00da\u00db\7"+
|
||||
"\61\2\2\u00db>\3\2\2\2\u00dc\u00dd\7\'\2\2\u00dd@\3\2\2\2\u00de\u00df"+
|
||||
"\7>\2\2\u00dfB\3\2\2\2\u00e0\u00e1\7@\2\2\u00e1D\3\2\2\2\u00e2\u00e3\7"+
|
||||
">\2\2\u00e3\u00e4\7?\2\2\u00e4F\3\2\2\2\u00e5\u00e6\7@\2\2\u00e6\u00e7"+
|
||||
"\7?\2\2\u00e7H\3\2\2\2\u00e8\u00e9\7?\2\2\u00e9\u00ea\7?\2\2\u00eaJ\3"+
|
||||
"\2\2\2\u00eb\u00ec\7#\2\2\u00ec\u00ed\7?\2\2\u00edL\3\2\2\2\u00ee\u00ef"+
|
||||
"\7(\2\2\u00ef\u00f0\7(\2\2\u00f0N\3\2\2\2\u00f1\u00f2\7~\2\2\u00f2\u00f3"+
|
||||
"\7~\2\2\u00f3P\3\2\2\2\u00f4\u00f5\t\2\2\2\u00f5R\3\2\2\2\u00f6\u00f7"+
|
||||
"\4\62;\2\u00f7T\3\2\2\2\u00f8\u00fb\5S*\2\u00f9\u00fb\t\3\2\2\u00fa\u00f8"+
|
||||
"\3\2\2\2\u00fa\u00f9\3\2\2\2\u00fbV\3\2\2\2\u00fc\u0105\7\62\2\2\u00fd"+
|
||||
"\u0101\4\63;\2\u00fe\u0100\5S*\2\u00ff\u00fe\3\2\2\2\u0100\u0103\3\2\2"+
|
||||
"\2\u0101\u00ff\3\2\2\2\u0101\u0102\3\2\2\2\u0102\u0105\3\2\2\2\u0103\u0101"+
|
||||
"\3\2\2\2\u0104\u00fc\3\2\2\2\u0104\u00fd\3\2\2\2\u0105X\3\2\2\2\u0106"+
|
||||
"\u0107\7\62\2\2\u0107\u010b\7z\2\2\u0108\u0109\7\62\2\2\u0109\u010b\7"+
|
||||
"Z\2\2\u010a\u0106\3\2\2\2\u010a\u0108\3\2\2\2\u010b\u010d\3\2\2\2\u010c"+
|
||||
"\u010e\5U+\2\u010d\u010c\3\2\2\2\u010e\u010f\3\2\2\2\u010f\u010d\3\2\2"+
|
||||
"\2\u010f\u0110\3\2\2\2\u0110Z\3\2\2\2\u0111\u0114\5W,\2\u0112\u0114\5"+
|
||||
"Y-\2\u0113\u0111\3\2\2\2\u0113\u0112\3\2\2\2\u0114\\\3\2\2\2\u0115\u0116"+
|
||||
"\7h\2\2\u0116\u0117\7c\2\2\u0117\u0118\7n\2\2\u0118\u0119\7u\2\2\u0119"+
|
||||
"\u011f\7g\2\2\u011a\u011b\7v\2\2\u011b\u011c\7t\2\2\u011c\u011d\7w\2\2"+
|
||||
"\u011d\u011f\7g\2\2\u011e\u0115\3\2\2\2\u011e\u011a\3\2\2\2\u011f^\3\2"+
|
||||
"\2\2\u0120\u0125\5Q)\2\u0121\u0124\5Q)\2\u0122\u0124\5S*\2\u0123\u0121"+
|
||||
"\3\2\2\2\u0123\u0122\3\2\2\2\u0124\u0127\3\2\2\2\u0125\u0123\3\2\2\2\u0125"+
|
||||
"\u0126\3\2\2\2\u0126`\3\2\2\2\u0127\u0125\3\2\2\2\u0128\u0129\7\61\2\2"+
|
||||
"\u0129\u012a\7,\2\2\u012a\u012e\3\2\2\2\u012b\u012d\13\2\2\2\u012c\u012b"+
|
||||
"\3\2\2\2\u012d\u0130\3\2\2\2\u012e\u012f\3\2\2\2\u012e\u012c\3\2\2\2\u012f"+
|
||||
"\u0131\3\2\2\2\u0130\u012e\3\2\2\2\u0131\u0132\7,\2\2\u0132\u0133\7\61"+
|
||||
"\2\2\u0133\u0134\3\2\2\2\u0134\u0135\b\61\2\2\u0135b\3\2\2\2\u0136\u0137"+
|
||||
"\7\61\2\2\u0137\u0138\7\61\2\2\u0138\u013c\3\2\2\2\u0139\u013b\n\4\2\2"+
|
||||
"\u013a\u0139\3\2\2\2\u013b\u013e\3\2\2\2\u013c\u013a\3\2\2\2\u013c\u013d"+
|
||||
"\3\2\2\2\u013d\u013f\3\2\2\2\u013e\u013c\3\2\2\2\u013f\u0140\b\62\2\2"+
|
||||
"\u0140d\3\2\2\2\u0141\u0142\t\5\2\2\u0142\u0143\3\2\2\2\u0143\u0144\b"+
|
||||
"\63\2\2\u0144f\3\2\2\2\u0145\u0146\13\2\2\2\u0146h\3\2\2\2\16\2\u00fa"+
|
||||
"\u0101\u0104\u010a\u010f\u0113\u011e\u0123\u0125\u012e\u013c\3\b\2\2";
|
||||
public static final ATN _ATN =
|
||||
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
|
||||
static {
|
||||
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
|
||||
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
|
||||
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
|
||||
}
|
||||
}
|
||||
}
|
85
src/cd/frontend/parser/JavaliLexer.tokens
Normal file
85
src/cd/frontend/parser/JavaliLexer.tokens
Normal file
|
@ -0,0 +1,85 @@
|
|||
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
|
||||
T__35=36
|
||||
T__36=37
|
||||
T__37=38
|
||||
T__38=39
|
||||
Integer=40
|
||||
Boolean=41
|
||||
Ident=42
|
||||
COMMENT=43
|
||||
LINE_COMMENT=44
|
||||
WS=45
|
||||
ErrorCharacter=46
|
||||
'null'=1
|
||||
'['=2
|
||||
']'=3
|
||||
'boolean'=4
|
||||
'int'=5
|
||||
'class'=6
|
||||
'extends'=7
|
||||
'{'=8
|
||||
'}'=9
|
||||
','=10
|
||||
';'=11
|
||||
'void'=12
|
||||
'('=13
|
||||
')'=14
|
||||
'.'=15
|
||||
'='=16
|
||||
'write'=17
|
||||
'writeln'=18
|
||||
'if'=19
|
||||
'else'=20
|
||||
'while'=21
|
||||
'return'=22
|
||||
'new'=23
|
||||
'read'=24
|
||||
'this'=25
|
||||
'+'=26
|
||||
'-'=27
|
||||
'!'=28
|
||||
'*'=29
|
||||
'/'=30
|
||||
'%'=31
|
||||
'<'=32
|
||||
'>'=33
|
||||
'<='=34
|
||||
'>='=35
|
||||
'=='=36
|
||||
'!='=37
|
||||
'&&'=38
|
||||
'||'=39
|
2315
src/cd/frontend/parser/JavaliParser.java
Normal file
2315
src/cd/frontend/parser/JavaliParser.java
Normal file
File diff suppressed because it is too large
Load diff
278
src/cd/frontend/parser/JavaliVisitor.java
Normal file
278
src/cd/frontend/parser/JavaliVisitor.java
Normal file
|
@ -0,0 +1,278 @@
|
|||
// Generated from /home/carlos/eth/cd/nop90/HW2/src/cd/frontend/parser/Javali.g4 by ANTLR 4.7.1
|
||||
|
||||
// Java header
|
||||
package cd.frontend.parser;
|
||||
|
||||
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
|
||||
|
||||
/**
|
||||
* This interface defines a complete generic visitor for a parse tree produced
|
||||
* by {@link JavaliParser}.
|
||||
*
|
||||
* @param <T> The return type of the visit operation. Use {@link Void} for
|
||||
* operations with no return type.
|
||||
*/
|
||||
public interface JavaliVisitor<T> extends ParseTreeVisitor<T> {
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code NullLiteral}
|
||||
* labeled alternative in {@link JavaliParser#literal}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitNullLiteral(JavaliParser.NullLiteralContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code BoolLiteral}
|
||||
* labeled alternative in {@link JavaliParser#literal}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitBoolLiteral(JavaliParser.BoolLiteralContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code IntLiteral}
|
||||
* labeled alternative in {@link JavaliParser#literal}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitIntLiteral(JavaliParser.IntLiteralContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#type}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitType(JavaliParser.TypeContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#referenceType}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitReferenceType(JavaliParser.ReferenceTypeContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#arrayType}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitArrayType(JavaliParser.ArrayTypeContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#primitiveType}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitPrimitiveType(JavaliParser.PrimitiveTypeContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#unit}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitUnit(JavaliParser.UnitContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#classDecl}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitClassDecl(JavaliParser.ClassDeclContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#memberList}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitMemberList(JavaliParser.MemberListContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#varDecl}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitVarDecl(JavaliParser.VarDeclContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#methodDecl}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitMethodDecl(JavaliParser.MethodDeclContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#formalParamList}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitFormalParamList(JavaliParser.FormalParamListContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#stmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitStmt(JavaliParser.StmtContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#stmtBlock}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitStmtBlock(JavaliParser.StmtBlockContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code LocalMethodCallStmt}
|
||||
* labeled alternative in {@link JavaliParser#methodCallStmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitLocalMethodCallStmt(JavaliParser.LocalMethodCallStmtContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code ObjectMethodCallStmt}
|
||||
* labeled alternative in {@link JavaliParser#methodCallStmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitObjectMethodCallStmt(JavaliParser.ObjectMethodCallStmtContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#assignmentStmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitAssignmentStmt(JavaliParser.AssignmentStmtContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code Write}
|
||||
* labeled alternative in {@link JavaliParser#writeStmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitWrite(JavaliParser.WriteContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code WriteLn}
|
||||
* labeled alternative in {@link JavaliParser#writeStmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitWriteLn(JavaliParser.WriteLnContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#ifStmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitIfStmt(JavaliParser.IfStmtContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#whileStmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitWhileStmt(JavaliParser.WhileStmtContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#returnStmt}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitReturnStmt(JavaliParser.ReturnStmtContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code NewObject}
|
||||
* labeled alternative in {@link JavaliParser#newExpr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitNewObject(JavaliParser.NewObjectContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code NewObjectArray}
|
||||
* labeled alternative in {@link JavaliParser#newExpr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitNewObjectArray(JavaliParser.NewObjectArrayContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code NewPrimitiveArray}
|
||||
* labeled alternative in {@link JavaliParser#newExpr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitNewPrimitiveArray(JavaliParser.NewPrimitiveArrayContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#readExpr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitReadExpr(JavaliParser.ReadExprContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by {@link JavaliParser#actualParamList}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitActualParamList(JavaliParser.ActualParamListContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code AccessThis}
|
||||
* labeled alternative in {@link JavaliParser#identAccess}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitAccessThis(JavaliParser.AccessThisContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code AccessLocalField}
|
||||
* labeled alternative in {@link JavaliParser#identAccess}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitAccessLocalField(JavaliParser.AccessLocalFieldContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code AccessObjectField}
|
||||
* labeled alternative in {@link JavaliParser#identAccess}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitAccessObjectField(JavaliParser.AccessObjectFieldContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code AccessLocalMethod}
|
||||
* labeled alternative in {@link JavaliParser#identAccess}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitAccessLocalMethod(JavaliParser.AccessLocalMethodContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code AccessArray}
|
||||
* labeled alternative in {@link JavaliParser#identAccess}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitAccessArray(JavaliParser.AccessArrayContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code AccessObjectMethod}
|
||||
* labeled alternative in {@link JavaliParser#identAccess}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitAccessObjectMethod(JavaliParser.AccessObjectMethodContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code ExprBinary}
|
||||
* labeled alternative in {@link JavaliParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprBinary(JavaliParser.ExprBinaryContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code ExprCast}
|
||||
* labeled alternative in {@link JavaliParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprCast(JavaliParser.ExprCastContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code ExprParentheses}
|
||||
* labeled alternative in {@link JavaliParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprParentheses(JavaliParser.ExprParenthesesContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code ExprUnary}
|
||||
* labeled alternative in {@link JavaliParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprUnary(JavaliParser.ExprUnaryContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code ExprConstant}
|
||||
* labeled alternative in {@link JavaliParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprConstant(JavaliParser.ExprConstantContext ctx);
|
||||
/**
|
||||
* Visit a parse tree produced by the {@code ExprIdentAccess}
|
||||
* labeled alternative in {@link JavaliParser#expr}.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
T visitExprIdentAccess(JavaliParser.ExprIdentAccessContext ctx);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue