1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-12-22 21:29:50 +00:00

Added syntax for functions & arrays.

This commit is contained in:
jespergravgaard 2017-05-23 08:51:39 +02:00
parent a565a0bea7
commit 15b1dc60fe
15 changed files with 2244 additions and 414 deletions

View File

@ -5,7 +5,7 @@ import dk.camelot64.kickc.parser.KickCParser;
import org.antlr.v4.runtime.tree.TerminalNode;
/** Generates program SSA form by visiting the ANTLR4 parse tree*/
public class Pass1GenerateStatementSequence extends KickCBaseVisitor<RValue> {
public class Pass1GenerateStatementSequence extends KickCBaseVisitor<Object> {
private SymbolTable symbolTable;
private StatementSequence sequence;
@ -20,14 +20,13 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<RValue> {
}
@Override
public RValue visitFile(KickCParser.FileContext ctx) {
public Void visitFile(KickCParser.FileContext ctx) {
this.visit(ctx.stmtSeq());
return null;
}
@Override
public RValue visitStmtSeq(KickCParser.StmtSeqContext ctx) {
public Void visitStmtSeq(KickCParser.StmtSeqContext ctx) {
for(int i=0; i<ctx.getChildCount(); i++) {
this.visit(ctx.stmt(i));
}
@ -35,20 +34,20 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<RValue> {
}
@Override
public RValue visitStmtBlock(KickCParser.StmtBlockContext ctx) {
public Void visitStmtBlock(KickCParser.StmtBlockContext ctx) {
this.visit(ctx.stmtSeq());
return null;
}
@Override
public RValue visitStmtExpr(KickCParser.StmtExprContext ctx) {
public Void visitStmtExpr(KickCParser.StmtExprContext ctx) {
this.visit(ctx.expr());
return null;
}
@Override
public RValue visitStmtIfElse(KickCParser.StmtIfElseContext ctx) {
RValue rValue = this.visit(ctx.expr());
public Void visitStmtIfElse(KickCParser.StmtIfElseContext ctx) {
RValue rValue = (RValue) this.visit(ctx.expr());
Label ifJumpLabel = symbolTable.newIntermediateJumpLabel();
Label elseJumpLabel = symbolTable.newIntermediateJumpLabel();
Statement ifJmpStmt = new StatementConditionalJump(rValue, ifJumpLabel);
@ -76,13 +75,13 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<RValue> {
}
@Override
public RValue visitStmtWhile(KickCParser.StmtWhileContext ctx) {
public Void visitStmtWhile(KickCParser.StmtWhileContext ctx) {
Label beginJumpLabel = symbolTable.newIntermediateJumpLabel();
Label doJumpLabel = symbolTable.newIntermediateJumpLabel();
Label endJumpLabel = symbolTable.newIntermediateJumpLabel();
StatementJumpTarget beginJumpTarget = new StatementJumpTarget(beginJumpLabel);
sequence.addStatement(beginJumpTarget);
RValue rValue = this.visit(ctx.expr());
RValue rValue = (RValue) this.visit(ctx.expr());
Statement doJmpStmt = new StatementConditionalJump(rValue, doJumpLabel);
sequence.addStatement(doJmpStmt);
Statement endJmpStmt = new StatementJump(endJumpLabel);
@ -98,31 +97,112 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<RValue> {
}
@Override
public RValue visitStmtDoWhile(KickCParser.StmtDoWhileContext ctx) {
public Void visitStmtDoWhile(KickCParser.StmtDoWhileContext ctx) {
Label beginJumpLabel = symbolTable.newIntermediateJumpLabel();
StatementJumpTarget beginJumpTarget = new StatementJumpTarget(beginJumpLabel);
sequence.addStatement(beginJumpTarget);
this.visit(ctx.stmt());
RValue rValue = this.visit(ctx.expr());
RValue rValue = (RValue) this.visit(ctx.expr());
Statement doJmpStmt = new StatementConditionalJump(rValue, beginJumpLabel);
sequence.addStatement(doJmpStmt);
return null;
}
@Override
public RValue visitStmtAssignment(KickCParser.StmtAssignmentContext ctx) {
if(ctx.TYPE()!=null) {
symbolTable.newVariableDeclaration(ctx.NAME().getText(), ctx.TYPE().getText());
public Void visitStmtFunction(KickCParser.StmtFunctionContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public Void visitStmtReturn(KickCParser.StmtReturnContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public Void visitStmtDeclaration(KickCParser.StmtDeclarationContext ctx) {
if(ctx.getChild(0).getText().equals("const")) {
System.out.println("Const!"+ctx.getText());
}
if(ctx.expr()!=null) {
RValue rValue = this.visit(ctx.expr());
VariableUnversioned variable = symbolTable.newVariableUsage(ctx.NAME().getText());
Statement stmt = new StatementAssignment(variable, rValue);
SymbolType type = (SymbolType)visit(ctx.typeDecl());
VariableUnversioned lValue = symbolTable.newVariableDeclaration(ctx.NAME().getText(), type);
if(ctx.initializer()!=null) {
RValue rValue = (RValue) visit(ctx.initializer());
Statement stmt = new StatementAssignment(lValue, rValue);
sequence.addStatement(stmt);
}
return null;
}
@Override
public Void visitStmtAssignment(KickCParser.StmtAssignmentContext ctx) {
LValue lValue = (LValue) visit(ctx.lvalue());
RValue rValue = (RValue) this.visit(ctx.expr());
Statement stmt = new StatementAssignment(lValue, rValue);
sequence.addStatement(stmt);
return null;
}
@Override
public LValue visitLvalueName(KickCParser.LvalueNameContext ctx) {
return symbolTable.newVariableUsage(ctx.NAME().getText());
}
@Override
public LValue visitLvaluePar(KickCParser.LvalueParContext ctx) {
return (LValue) visit(ctx.lvalue());
}
@Override
public LValue visitLvaluePtr(KickCParser.LvaluePtrContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public LValue visitLvalueArray(KickCParser.LvalueArrayContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public RValue visitInitExpr(KickCParser.InitExprContext ctx) {
return (RValue) visit(ctx.expr());
}
@Override
public RValue visitInitList(KickCParser.InitListContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public SymbolType visitTypeSimple(KickCParser.TypeSimpleContext ctx) {
return SymbolType.get(ctx.getText());
}
@Override
public SymbolType visitTypePtr(KickCParser.TypePtrContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public SymbolType visitTypeArray(KickCParser.TypeArrayContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public RValue visitExprCast(KickCParser.ExprCastContext ctx) {
System.out.println("Cast type ignored!");
return (RValue) visit(ctx.expr());
}
@Override
public Object visitExprCall(KickCParser.ExprCallContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public Object visitExprArray(KickCParser.ExprArrayContext ctx) {
throw new RuntimeException("Not implemented");
}
@Override
public RValue visitExprNumber(KickCParser.ExprNumberContext ctx) {
Number number = NumberParser.parseLiteral(ctx.getText());
@ -147,8 +227,8 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<RValue> {
@Override
public RValue visitExprBinary(KickCParser.ExprBinaryContext ctx) {
RValue left = this.visit(ctx.expr(0));
RValue right = this.visit(ctx.expr(1));
RValue left = (RValue) this.visit(ctx.expr(0));
RValue right = (RValue) this.visit(ctx.expr(1));
String op = ((TerminalNode)ctx.getChild(1)).getSymbol().getText();
Operator operator = new Operator(op);
VariableIntermediate tmpVar = symbolTable.newIntermediateAssignment();
@ -159,7 +239,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<RValue> {
@Override
public RValue visitExprUnary(KickCParser.ExprUnaryContext ctx) {
RValue child = this.visit(ctx.expr());
RValue child = (RValue) this.visit(ctx.expr());
String op = ((TerminalNode)ctx.getChild(0)).getSymbol().getText();
Operator operator = new Operator(op);
VariableIntermediate tmpVar = symbolTable.newIntermediateAssignment();
@ -170,7 +250,7 @@ public class Pass1GenerateStatementSequence extends KickCBaseVisitor<RValue> {
@Override
public RValue visitExprPar(KickCParser.ExprParContext ctx) {
return this.visit(ctx.expr());
return (RValue) this.visit(ctx.expr());
}
@Override

View File

@ -24,6 +24,7 @@ public class Pass3RegisterAllocation {
}
allocation.allocate(symbols.getVariable("i#1"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("i#2"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("i#3"), RegisterAllocation.getRegisterX());
allocation.allocate(symbols.getVariable("n1#1"), RegisterAllocation.getRegisterY());
allocation.allocate(symbols.getVariable("n1#2"), RegisterAllocation.getRegisterY());
symbols.setAllocation(allocation);

View File

@ -36,6 +36,12 @@ public class SymbolTable {
return symbol;
}
public VariableUnversioned newVariableDeclaration(String name, SymbolType type) {
VariableUnversioned symbol = new VariableUnversioned(name, type);
addSymbol(symbol);
return symbol;
}
public VariableUnversioned newVariableDeclaration(String name, String type) {
SymbolType symbolType = SymbolType.get(type);
VariableUnversioned symbol = new VariableUnversioned(name, symbolType);

View File

@ -10,30 +10,63 @@ stmtSeq
;
stmt
: '{' stmtSeq '}' #stmtBlock
| (TYPE)? NAME ('=' expr)? ';' #stmtAssignment
: '{' stmtSeq? '}' #stmtBlock
| typeDecl NAME '(' parameterListDecl? ')' '{' stmtSeq? '}' #stmtFunction
| ('const')? typeDecl NAME ('=' initializer)? ';' #stmtDeclaration
| lvalue '=' expr ';' #stmtAssignment
| expr ';' #stmtExpr
| 'if' '(' expr ')' stmt ( 'else' stmt )? #stmtIfElse
| 'while' '(' expr ')' stmt #stmtWhile
| 'do' stmt 'while' '(' expr ')' #stmtDoWhile
| 'return' expr ';' #stmtReturn
;
parameterListDecl
: parameterDecl (',' parameterDecl)* ;
parameterDecl
: typeDecl NAME ;
typeDecl
: SIMPLETYPE #typeSimple
| typeDecl '*' #typePtr
| typeDecl '[' (expr)? ']' #typeArray
;
initializer
: expr #initExpr
| '{' initializer (',' initializer )* '}' #initList
;
lvalue
: '(' lvalue ')' #lvaluePar
| NAME #lvalueName
| '*' lvalue #lvaluePtr
| lvalue '[' expr ']' #lvalueArray
;
expr
: '(' expr ')' #exprPar
| ('+' | '-' | 'not' | '!') expr #exprUnary
| NAME '(' parameterList? ')' #exprCall
| '(' typeDecl ')' expr #exprCast
| expr '[' expr ']' #exprArray
| ('+' | '-' | 'not' | '!' | '&' | '*') expr #exprUnary
| expr ('*' | '/' ) expr #exprBinary
| expr ( '+' | '-') expr #exprBinary
| expr ( '==' | '!=' | '<>' | '<' | '<=' | '=<' | '>=' | '=>' | '>' ) expr #exprBinary
| expr ( 'and' | '&&' ) expr #exprBinary
| expr ( 'or' | '||' ) expr #exprBinary
| NAME #exprId
| NAME #exprId
| NUMBER #exprNumber
| STRING #exprString
| BOOLEAN #exprBool
;
TYPE: 'byte' | 'word' | 'string' | 'boolean';
parameterList
: expr (',' expr)*
;
SIMPLETYPE: 'byte' | 'word' | 'string' | 'boolean' | 'void' ;
STRING : '"' ('\\"' | ~'"')* '"';
BOOLEAN : 'true' | 'false';
NUMBER : NUMFLOAT | NUMINT ;
@ -51,4 +84,6 @@ fragment HEXDIGIT : [0-9a-fA-F];
NAME : NAME_START NAME_CHAR* ;
fragment NAME_START : [a-zA-Z_];
fragment NAME_CHAR : [a-zA-Z0-9_];
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
WS : [ \t\r\n]+ -> skip ;
COMMENT_LINE : '//' ~[\r\n]* -> skip ;
COMMENT_BLOCK : '/*' .*? '*/' -> skip;

View File

@ -27,46 +27,60 @@ T__25=26
T__26=27
T__27=28
T__28=29
TYPE=30
STRING=31
BOOLEAN=32
NUMBER=33
NUMFLOAT=34
BINFLOAT=35
DECFLOAT=36
HEXFLOAT=37
NUMINT=38
BININTEGER=39
DECINTEGER=40
HEXINTEGER=41
NAME=42
WS=43
T__29=30
T__30=31
T__31=32
T__32=33
T__33=34
T__34=35
SIMPLETYPE=36
STRING=37
BOOLEAN=38
NUMBER=39
NUMFLOAT=40
BINFLOAT=41
DECFLOAT=42
HEXFLOAT=43
NUMINT=44
BININTEGER=45
DECINTEGER=46
HEXINTEGER=47
NAME=48
WS=49
COMMENT_LINE=50
COMMENT_BLOCK=51
'{'=1
'}'=2
'='=3
';'=4
'if'=5
'('=6
')'=7
'else'=8
'while'=9
'do'=10
'+'=11
'-'=12
'not'=13
'!'=14
'*'=15
'/'=16
'=='=17
'!='=18
'<>'=19
'<'=20
'<='=21
'=<'=22
'>='=23
'=>'=24
'>'=25
'and'=26
'&&'=27
'or'=28
'||'=29
'('=3
')'=4
'const'=5
'='=6
';'=7
'if'=8
'else'=9
'while'=10
'do'=11
'return'=12
','=13
'*'=14
'['=15
']'=16
'+'=17
'-'=18
'not'=19
'!'=20
'&'=21
'/'=22
'=='=23
'!='=24
'<>'=25
'<'=26
'<='=27
'=<'=28
'>='=29
'=>'=30
'>'=31
'and'=32
'&&'=33
'or'=34
'||'=35

View File

@ -47,6 +47,30 @@ public class KickCBaseListener implements KickCListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStmtBlock(KickCParser.StmtBlockContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStmtFunction(KickCParser.StmtFunctionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStmtFunction(KickCParser.StmtFunctionContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStmtDeclaration(KickCParser.StmtDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStmtDeclaration(KickCParser.StmtDeclarationContext ctx) { }
/**
* {@inheritDoc}
*
@ -107,6 +131,174 @@ public class KickCBaseListener implements KickCListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStmtDoWhile(KickCParser.StmtDoWhileContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStmtReturn(KickCParser.StmtReturnContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStmtReturn(KickCParser.StmtReturnContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterParameterListDecl(KickCParser.ParameterListDeclContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitParameterListDecl(KickCParser.ParameterListDeclContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterParameterDecl(KickCParser.ParameterDeclContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitParameterDecl(KickCParser.ParameterDeclContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypePtr(KickCParser.TypePtrContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypePtr(KickCParser.TypePtrContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeArray(KickCParser.TypeArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeArray(KickCParser.TypeArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSimple(KickCParser.TypeSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSimple(KickCParser.TypeSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterInitExpr(KickCParser.InitExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitInitExpr(KickCParser.InitExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterInitList(KickCParser.InitListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitInitList(KickCParser.InitListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLvalueName(KickCParser.LvalueNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLvalueName(KickCParser.LvalueNameContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLvaluePtr(KickCParser.LvaluePtrContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLvaluePtr(KickCParser.LvaluePtrContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLvalueArray(KickCParser.LvalueArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLvalueArray(KickCParser.LvalueArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterLvaluePar(KickCParser.LvalueParContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitLvaluePar(KickCParser.LvalueParContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExprCast(KickCParser.ExprCastContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExprCast(KickCParser.ExprCastContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExprCall(KickCParser.ExprCallContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExprCall(KickCParser.ExprCallContext ctx) { }
/**
* {@inheritDoc}
*
@ -191,6 +383,30 @@ public class KickCBaseListener implements KickCListener {
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExprNumber(KickCParser.ExprNumberContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterExprArray(KickCParser.ExprArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitExprArray(KickCParser.ExprArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterParameterList(KickCParser.ParameterListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitParameterList(KickCParser.ParameterListContext ctx) { }
/**
* {@inheritDoc}

View File

@ -32,6 +32,20 @@ public class KickCBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStmtBlock(KickCParser.StmtBlockContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStmtFunction(KickCParser.StmtFunctionContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStmtDeclaration(KickCParser.StmtDeclarationContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
@ -67,6 +81,104 @@ public class KickCBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStmtDoWhile(KickCParser.StmtDoWhileContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStmtReturn(KickCParser.StmtReturnContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitParameterListDecl(KickCParser.ParameterListDeclContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitParameterDecl(KickCParser.ParameterDeclContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypePtr(KickCParser.TypePtrContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeArray(KickCParser.TypeArrayContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSimple(KickCParser.TypeSimpleContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitInitExpr(KickCParser.InitExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitInitList(KickCParser.InitListContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLvalueName(KickCParser.LvalueNameContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLvaluePtr(KickCParser.LvaluePtrContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLvalueArray(KickCParser.LvalueArrayContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitLvaluePar(KickCParser.LvalueParContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitExprCast(KickCParser.ExprCastContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitExprCall(KickCParser.ExprCallContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
@ -116,4 +228,18 @@ public class KickCBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitExprNumber(KickCParser.ExprNumberContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitExprArray(KickCParser.ExprArrayContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitParameterList(KickCParser.ParameterListContext ctx) { return visitChildren(ctx); }
}

View File

@ -20,9 +20,11 @@ public class KickCLexer extends Lexer {
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, TYPE=30, STRING=31,
BOOLEAN=32, NUMBER=33, NUMFLOAT=34, BINFLOAT=35, DECFLOAT=36, HEXFLOAT=37,
NUMINT=38, BININTEGER=39, DECINTEGER=40, HEXINTEGER=41, NAME=42, WS=43;
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, SIMPLETYPE=36, STRING=37, BOOLEAN=38,
NUMBER=39, NUMFLOAT=40, BINFLOAT=41, DECFLOAT=42, HEXFLOAT=43, NUMINT=44,
BININTEGER=45, DECINTEGER=46, HEXINTEGER=47, NAME=48, WS=49, COMMENT_LINE=50,
COMMENT_BLOCK=51;
public static String[] channelNames = {
"DEFAULT_TOKEN_CHANNEL", "HIDDEN"
};
@ -35,24 +37,26 @@ public class KickCLexer extends Lexer {
"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", "TYPE", "STRING", "BOOLEAN", "NUMBER",
"NUMFLOAT", "BINFLOAT", "DECFLOAT", "HEXFLOAT", "NUMINT", "BININTEGER",
"DECINTEGER", "HEXINTEGER", "BINDIGIT", "DECDIGIT", "HEXDIGIT", "NAME",
"NAME_START", "NAME_CHAR", "WS"
"T__25", "T__26", "T__27", "T__28", "T__29", "T__30", "T__31", "T__32",
"T__33", "T__34", "SIMPLETYPE", "STRING", "BOOLEAN", "NUMBER", "NUMFLOAT",
"BINFLOAT", "DECFLOAT", "HEXFLOAT", "NUMINT", "BININTEGER", "DECINTEGER",
"HEXINTEGER", "BINDIGIT", "DECDIGIT", "HEXDIGIT", "NAME", "NAME_START",
"NAME_CHAR", "WS", "COMMENT_LINE", "COMMENT_BLOCK"
};
private static final String[] _LITERAL_NAMES = {
null, "'{'", "'}'", "'='", "';'", "'if'", "'('", "')'", "'else'", "'while'",
"'do'", "'+'", "'-'", "'not'", "'!'", "'*'", "'/'", "'=='", "'!='", "'<>'",
"'<'", "'<='", "'=<'", "'>='", "'=>'", "'>'", "'and'", "'&&'", "'or'",
"'||'"
null, "'{'", "'}'", "'('", "')'", "'const'", "'='", "';'", "'if'", "'else'",
"'while'", "'do'", "'return'", "','", "'*'", "'['", "']'", "'+'", "'-'",
"'not'", "'!'", "'&'", "'/'", "'=='", "'!='", "'<>'", "'<'", "'<='", "'=<'",
"'>='", "'=>'", "'>'", "'and'", "'&&'", "'or'", "'||'"
};
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, "TYPE", "STRING", "BOOLEAN", "NUMBER",
"NUMFLOAT", "BINFLOAT", "DECFLOAT", "HEXFLOAT", "NUMINT", "BININTEGER",
"DECINTEGER", "HEXINTEGER", "NAME", "WS"
null, null, null, null, null, null, null, null, null, null, null, null,
"SIMPLETYPE", "STRING", "BOOLEAN", "NUMBER", "NUMFLOAT", "BINFLOAT", "DECFLOAT",
"HEXFLOAT", "NUMINT", "BININTEGER", "DECINTEGER", "HEXINTEGER", "NAME",
"WS", "COMMENT_LINE", "COMMENT_BLOCK"
};
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
@ -112,124 +116,148 @@ public class KickCLexer extends Lexer {
public ATN getATN() { return _ATN; }
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2-\u0159\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\3\2\3\2\3\3\3\3\3\4\3\4\3\5"+
"\3\5\3\6\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3"+
"\n\3\n\3\13\3\13\3\13\3\f\3\f\3\r\3\r\3\16\3\16\3\16\3\16\3\17\3\17\3"+
"\20\3\20\3\21\3\21\3\22\3\22\3\22\3\23\3\23\3\23\3\24\3\24\3\24\3\25\3"+
"\25\3\26\3\26\3\26\3\27\3\27\3\27\3\30\3\30\3\30\3\31\3\31\3\31\3\32\3"+
"\32\3\33\3\33\3\33\3\33\3\34\3\34\3\34\3\35\3\35\3\35\3\36\3\36\3\36\3"+
"\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3\37\3"+
"\37\3\37\3\37\3\37\3\37\3\37\3\37\5\37\u00ca\n\37\3 \3 \3 \3 \7 \u00d0"+
"\n \f \16 \u00d3\13 \3 \3 \3!\3!\3!\3!\3!\3!\3!\3!\3!\5!\u00e0\n!\3\""+
"\3\"\5\"\u00e4\n\"\3#\3#\3#\5#\u00e9\n#\3$\3$\3$\3$\3$\5$\u00f0\n$\3$"+
"\7$\u00f3\n$\f$\16$\u00f6\13$\3$\3$\6$\u00fa\n$\r$\16$\u00fb\3%\7%\u00ff"+
"\n%\f%\16%\u0102\13%\3%\3%\6%\u0106\n%\r%\16%\u0107\3&\3&\3&\3&\3&\5&"+
"\u010f\n&\3&\7&\u0112\n&\f&\16&\u0115\13&\3&\3&\6&\u0119\n&\r&\16&\u011a"+
"\3\'\3\'\3\'\5\'\u0120\n\'\3(\3(\3(\6(\u0125\n(\r(\16(\u0126\3(\3(\6("+
"\u012b\n(\r(\16(\u012c\5(\u012f\n(\3)\6)\u0132\n)\r)\16)\u0133\3*\3*\3"+
"*\3*\3*\5*\u013b\n*\3*\6*\u013e\n*\r*\16*\u013f\3+\3+\3,\3,\3-\3-\3.\3"+
".\7.\u014a\n.\f.\16.\u014d\13.\3/\3/\3\60\3\60\3\61\6\61\u0154\n\61\r"+
"\61\16\61\u0155\3\61\3\61\2\2\62\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*S+U\2W\2Y\2[,"+
"]\2_\2a-\3\2\n\3\2$$\4\2DDdd\3\2\62\63\3\2\62;\5\2\62;CHch\5\2C\\aac|"+
"\6\2\62;C\\aac|\5\2\13\f\17\17\"\"\2\u0171\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\2Q\3\2\2\2\2S\3\2\2\2\2[\3\2\2\2\2a\3\2\2\2\3c\3\2"+
"\2\2\5e\3\2\2\2\7g\3\2\2\2\ti\3\2\2\2\13k\3\2\2\2\rn\3\2\2\2\17p\3\2\2"+
"\2\21r\3\2\2\2\23w\3\2\2\2\25}\3\2\2\2\27\u0080\3\2\2\2\31\u0082\3\2\2"+
"\2\33\u0084\3\2\2\2\35\u0088\3\2\2\2\37\u008a\3\2\2\2!\u008c\3\2\2\2#"+
"\u008e\3\2\2\2%\u0091\3\2\2\2\'\u0094\3\2\2\2)\u0097\3\2\2\2+\u0099\3"+
"\2\2\2-\u009c\3\2\2\2/\u009f\3\2\2\2\61\u00a2\3\2\2\2\63\u00a5\3\2\2\2"+
"\65\u00a7\3\2\2\2\67\u00ab\3\2\2\29\u00ae\3\2\2\2;\u00b1\3\2\2\2=\u00c9"+
"\3\2\2\2?\u00cb\3\2\2\2A\u00df\3\2\2\2C\u00e3\3\2\2\2E\u00e8\3\2\2\2G"+
"\u00ef\3\2\2\2I\u0100\3\2\2\2K\u010e\3\2\2\2M\u011f\3\2\2\2O\u012e\3\2"+
"\2\2Q\u0131\3\2\2\2S\u013a\3\2\2\2U\u0141\3\2\2\2W\u0143\3\2\2\2Y\u0145"+
"\3\2\2\2[\u0147\3\2\2\2]\u014e\3\2\2\2_\u0150\3\2\2\2a\u0153\3\2\2\2c"+
"d\7}\2\2d\4\3\2\2\2ef\7\177\2\2f\6\3\2\2\2gh\7?\2\2h\b\3\2\2\2ij\7=\2"+
"\2j\n\3\2\2\2kl\7k\2\2lm\7h\2\2m\f\3\2\2\2no\7*\2\2o\16\3\2\2\2pq\7+\2"+
"\2q\20\3\2\2\2rs\7g\2\2st\7n\2\2tu\7u\2\2uv\7g\2\2v\22\3\2\2\2wx\7y\2"+
"\2xy\7j\2\2yz\7k\2\2z{\7n\2\2{|\7g\2\2|\24\3\2\2\2}~\7f\2\2~\177\7q\2"+
"\2\177\26\3\2\2\2\u0080\u0081\7-\2\2\u0081\30\3\2\2\2\u0082\u0083\7/\2"+
"\2\u0083\32\3\2\2\2\u0084\u0085\7p\2\2\u0085\u0086\7q\2\2\u0086\u0087"+
"\7v\2\2\u0087\34\3\2\2\2\u0088\u0089\7#\2\2\u0089\36\3\2\2\2\u008a\u008b"+
"\7,\2\2\u008b \3\2\2\2\u008c\u008d\7\61\2\2\u008d\"\3\2\2\2\u008e\u008f"+
"\7?\2\2\u008f\u0090\7?\2\2\u0090$\3\2\2\2\u0091\u0092\7#\2\2\u0092\u0093"+
"\7?\2\2\u0093&\3\2\2\2\u0094\u0095\7>\2\2\u0095\u0096\7@\2\2\u0096(\3"+
"\2\2\2\u0097\u0098\7>\2\2\u0098*\3\2\2\2\u0099\u009a\7>\2\2\u009a\u009b"+
"\7?\2\2\u009b,\3\2\2\2\u009c\u009d\7?\2\2\u009d\u009e\7>\2\2\u009e.\3"+
"\2\2\2\u009f\u00a0\7@\2\2\u00a0\u00a1\7?\2\2\u00a1\60\3\2\2\2\u00a2\u00a3"+
"\7?\2\2\u00a3\u00a4\7@\2\2\u00a4\62\3\2\2\2\u00a5\u00a6\7@\2\2\u00a6\64"+
"\3\2\2\2\u00a7\u00a8\7c\2\2\u00a8\u00a9\7p\2\2\u00a9\u00aa\7f\2\2\u00aa"+
"\66\3\2\2\2\u00ab\u00ac\7(\2\2\u00ac\u00ad\7(\2\2\u00ad8\3\2\2\2\u00ae"+
"\u00af\7q\2\2\u00af\u00b0\7t\2\2\u00b0:\3\2\2\2\u00b1\u00b2\7~\2\2\u00b2"+
"\u00b3\7~\2\2\u00b3<\3\2\2\2\u00b4\u00b5\7d\2\2\u00b5\u00b6\7{\2\2\u00b6"+
"\u00b7\7v\2\2\u00b7\u00ca\7g\2\2\u00b8\u00b9\7y\2\2\u00b9\u00ba\7q\2\2"+
"\u00ba\u00bb\7t\2\2\u00bb\u00ca\7f\2\2\u00bc\u00bd\7u\2\2\u00bd\u00be"+
"\7v\2\2\u00be\u00bf\7t\2\2\u00bf\u00c0\7k\2\2\u00c0\u00c1\7p\2\2\u00c1"+
"\u00ca\7i\2\2\u00c2\u00c3\7d\2\2\u00c3\u00c4\7q\2\2\u00c4\u00c5\7q\2\2"+
"\u00c5\u00c6\7n\2\2\u00c6\u00c7\7g\2\2\u00c7\u00c8\7c\2\2\u00c8\u00ca"+
"\7p\2\2\u00c9\u00b4\3\2\2\2\u00c9\u00b8\3\2\2\2\u00c9\u00bc\3\2\2\2\u00c9"+
"\u00c2\3\2\2\2\u00ca>\3\2\2\2\u00cb\u00d1\7$\2\2\u00cc\u00cd\7^\2\2\u00cd"+
"\u00d0\7$\2\2\u00ce\u00d0\n\2\2\2\u00cf\u00cc\3\2\2\2\u00cf\u00ce\3\2"+
"\2\2\u00d0\u00d3\3\2\2\2\u00d1\u00cf\3\2\2\2\u00d1\u00d2\3\2\2\2\u00d2"+
"\u00d4\3\2\2\2\u00d3\u00d1\3\2\2\2\u00d4\u00d5\7$\2\2\u00d5@\3\2\2\2\u00d6"+
"\u00d7\7v\2\2\u00d7\u00d8\7t\2\2\u00d8\u00d9\7w\2\2\u00d9\u00e0\7g\2\2"+
"\u00da\u00db\7h\2\2\u00db\u00dc\7c\2\2\u00dc\u00dd\7n\2\2\u00dd\u00de"+
"\7u\2\2\u00de\u00e0\7g\2\2\u00df\u00d6\3\2\2\2\u00df\u00da\3\2\2\2\u00e0"+
"B\3\2\2\2\u00e1\u00e4\5E#\2\u00e2\u00e4\5M\'\2\u00e3\u00e1\3\2\2\2\u00e3"+
"\u00e2\3\2\2\2\u00e4D\3\2\2\2\u00e5\u00e9\5G$\2\u00e6\u00e9\5I%\2\u00e7"+
"\u00e9\5K&\2\u00e8\u00e5\3\2\2\2\u00e8\u00e6\3\2\2\2\u00e8\u00e7\3\2\2"+
"\2\u00e9F\3\2\2\2\u00ea\u00f0\7\'\2\2\u00eb\u00ec\7\62\2\2\u00ec\u00f0"+
"\7d\2\2\u00ed\u00ee\7\62\2\2\u00ee\u00f0\7D\2\2\u00ef\u00ea\3\2\2\2\u00ef"+
"\u00eb\3\2\2\2\u00ef\u00ed\3\2\2\2\u00f0\u00f4\3\2\2\2\u00f1\u00f3\5U"+
"+\2\u00f2\u00f1\3\2\2\2\u00f3\u00f6\3\2\2\2\u00f4\u00f2\3\2\2\2\u00f4"+
"\u00f5\3\2\2\2\u00f5\u00f7\3\2\2\2\u00f6\u00f4\3\2\2\2\u00f7\u00f9\7\60"+
"\2\2\u00f8\u00fa\5U+\2\u00f9\u00f8\3\2\2\2\u00fa\u00fb\3\2\2\2\u00fb\u00f9"+
"\3\2\2\2\u00fb\u00fc\3\2\2\2\u00fcH\3\2\2\2\u00fd\u00ff\5W,\2\u00fe\u00fd"+
"\3\2\2\2\u00ff\u0102\3\2\2\2\u0100\u00fe\3\2\2\2\u0100\u0101\3\2\2\2\u0101"+
"\u0103\3\2\2\2\u0102\u0100\3\2\2\2\u0103\u0105\7\60\2\2\u0104\u0106\5"+
"W,\2\u0105\u0104\3\2\2\2\u0106\u0107\3\2\2\2\u0107\u0105\3\2\2\2\u0107"+
"\u0108\3\2\2\2\u0108J\3\2\2\2\u0109\u010f\7&\2\2\u010a\u010b\7\62\2\2"+
"\u010b\u010f\7z\2\2\u010c\u010d\7\62\2\2\u010d\u010f\7Z\2\2\u010e\u0109"+
"\3\2\2\2\u010e\u010a\3\2\2\2\u010e\u010c\3\2\2\2\u010f\u0113\3\2\2\2\u0110"+
"\u0112\5Y-\2\u0111\u0110\3\2\2\2\u0112\u0115\3\2\2\2\u0113\u0111\3\2\2"+
"\2\u0113\u0114\3\2\2\2\u0114\u0116\3\2\2\2\u0115\u0113\3\2\2\2\u0116\u0118"+
"\7\60\2\2\u0117\u0119\5Y-\2\u0118\u0117\3\2\2\2\u0119\u011a\3\2\2\2\u011a"+
"\u0118\3\2\2\2\u011a\u011b\3\2\2\2\u011bL\3\2\2\2\u011c\u0120\5Q)\2\u011d"+
"\u0120\5S*\2\u011e\u0120\5O(\2\u011f\u011c\3\2\2\2\u011f\u011d\3\2\2\2"+
"\u011f\u011e\3\2\2\2\u0120N\3\2\2\2\u0121\u0122\7\62\2\2\u0122\u0124\t"+
"\3\2\2\u0123\u0125\5U+\2\u0124\u0123\3\2\2\2\u0125\u0126\3\2\2\2\u0126"+
"\u0124\3\2\2\2\u0126\u0127\3\2\2\2\u0127\u012f\3\2\2\2\u0128\u012a\7\'"+
"\2\2\u0129\u012b\5U+\2\u012a\u0129\3\2\2\2\u012b\u012c\3\2\2\2\u012c\u012a"+
"\3\2\2\2\u012c\u012d\3\2\2\2\u012d\u012f\3\2\2\2\u012e\u0121\3\2\2\2\u012e"+
"\u0128\3\2\2\2\u012fP\3\2\2\2\u0130\u0132\5W,\2\u0131\u0130\3\2\2\2\u0132"+
"\u0133\3\2\2\2\u0133\u0131\3\2\2\2\u0133\u0134\3\2\2\2\u0134R\3\2\2\2"+
"\u0135\u013b\7&\2\2\u0136\u0137\7\62\2\2\u0137\u013b\7z\2\2\u0138\u0139"+
"\7\62\2\2\u0139\u013b\7Z\2\2\u013a\u0135\3\2\2\2\u013a\u0136\3\2\2\2\u013a"+
"\u0138\3\2\2\2\u013b\u013d\3\2\2\2\u013c\u013e\5Y-\2\u013d\u013c\3\2\2"+
"\2\u013e\u013f\3\2\2\2\u013f\u013d\3\2\2\2\u013f\u0140\3\2\2\2\u0140T"+
"\3\2\2\2\u0141\u0142\t\4\2\2\u0142V\3\2\2\2\u0143\u0144\t\5\2\2\u0144"+
"X\3\2\2\2\u0145\u0146\t\6\2\2\u0146Z\3\2\2\2\u0147\u014b\5]/\2\u0148\u014a"+
"\5_\60\2\u0149\u0148\3\2\2\2\u014a\u014d\3\2\2\2\u014b\u0149\3\2\2\2\u014b"+
"\u014c\3\2\2\2\u014c\\\3\2\2\2\u014d\u014b\3\2\2\2\u014e\u014f\t\7\2\2"+
"\u014f^\3\2\2\2\u0150\u0151\t\b\2\2\u0151`\3\2\2\2\u0152\u0154\t\t\2\2"+
"\u0153\u0152\3\2\2\2\u0154\u0155\3\2\2\2\u0155\u0153\3\2\2\2\u0155\u0156"+
"\3\2\2\2\u0156\u0157\3\2\2\2\u0157\u0158\b\61\2\2\u0158b\3\2\2\2\32\2"+
"\u00c9\u00cf\u00d1\u00df\u00e3\u00e8\u00ef\u00f4\u00fb\u0100\u0107\u010e"+
"\u0113\u011a\u011f\u0126\u012c\u012e\u0133\u013a\u013f\u014b\u0155\3\b"+
"\2\2";
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2\65\u019b\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\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\3\2\3\2\3\3\3\3\3\4\3"+
"\4\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3\7\3\b\3\b\3\t\3\t\3\t\3\n\3\n"+
"\3\n\3\n\3\n\3\13\3\13\3\13\3\13\3\13\3\13\3\f\3\f\3\f\3\r\3\r\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\23\3"+
"\23\3\24\3\24\3\24\3\24\3\25\3\25\3\26\3\26\3\27\3\27\3\30\3\30\3\30\3"+
"\31\3\31\3\31\3\32\3\32\3\32\3\33\3\33\3\34\3\34\3\34\3\35\3\35\3\35\3"+
"\36\3\36\3\36\3\37\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%\3%\3%\3%\3%\3%\3"+
"%\3%\3%\3%\3%\5%\u00f3\n%\3&\3&\3&\3&\7&\u00f9\n&\f&\16&\u00fc\13&\3&"+
"\3&\3\'\3\'\3\'\3\'\3\'\3\'\3\'\3\'\3\'\5\'\u0109\n\'\3(\3(\5(\u010d\n"+
"(\3)\3)\3)\5)\u0112\n)\3*\3*\3*\3*\3*\5*\u0119\n*\3*\7*\u011c\n*\f*\16"+
"*\u011f\13*\3*\3*\6*\u0123\n*\r*\16*\u0124\3+\7+\u0128\n+\f+\16+\u012b"+
"\13+\3+\3+\6+\u012f\n+\r+\16+\u0130\3,\3,\3,\3,\3,\5,\u0138\n,\3,\7,\u013b"+
"\n,\f,\16,\u013e\13,\3,\3,\6,\u0142\n,\r,\16,\u0143\3-\3-\3-\5-\u0149"+
"\n-\3.\3.\3.\6.\u014e\n.\r.\16.\u014f\3.\3.\6.\u0154\n.\r.\16.\u0155\5"+
".\u0158\n.\3/\6/\u015b\n/\r/\16/\u015c\3\60\3\60\3\60\3\60\3\60\5\60\u0164"+
"\n\60\3\60\6\60\u0167\n\60\r\60\16\60\u0168\3\61\3\61\3\62\3\62\3\63\3"+
"\63\3\64\3\64\7\64\u0173\n\64\f\64\16\64\u0176\13\64\3\65\3\65\3\66\3"+
"\66\3\67\6\67\u017d\n\67\r\67\16\67\u017e\3\67\3\67\38\38\38\38\78\u0187"+
"\n8\f8\168\u018a\138\38\38\39\39\39\39\79\u0192\n9\f9\169\u0195\139\3"+
"9\39\39\39\39\3\u0193\2:\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*S+U,W-Y.[/]\60_\61a\2c"+
"\2e\2g\62i\2k\2m\63o\64q\65\3\2\13\3\2$$\4\2DDdd\3\2\62\63\3\2\62;\5\2"+
"\62;CHch\5\2C\\aac|\6\2\62;C\\aac|\5\2\13\f\17\17\"\"\4\2\f\f\17\17\2"+
"\u01b6\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\2"+
"G\3\2\2\2\2I\3\2\2\2\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3"+
"\2\2\2\2U\3\2\2\2\2W\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2"+
"\2\2g\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2\2q\3\2\2\2\3s\3\2\2\2\5u\3\2\2\2\7"+
"w\3\2\2\2\ty\3\2\2\2\13{\3\2\2\2\r\u0081\3\2\2\2\17\u0083\3\2\2\2\21\u0085"+
"\3\2\2\2\23\u0088\3\2\2\2\25\u008d\3\2\2\2\27\u0093\3\2\2\2\31\u0096\3"+
"\2\2\2\33\u009d\3\2\2\2\35\u009f\3\2\2\2\37\u00a1\3\2\2\2!\u00a3\3\2\2"+
"\2#\u00a5\3\2\2\2%\u00a7\3\2\2\2\'\u00a9\3\2\2\2)\u00ad\3\2\2\2+\u00af"+
"\3\2\2\2-\u00b1\3\2\2\2/\u00b3\3\2\2\2\61\u00b6\3\2\2\2\63\u00b9\3\2\2"+
"\2\65\u00bc\3\2\2\2\67\u00be\3\2\2\29\u00c1\3\2\2\2;\u00c4\3\2\2\2=\u00c7"+
"\3\2\2\2?\u00ca\3\2\2\2A\u00cc\3\2\2\2C\u00d0\3\2\2\2E\u00d3\3\2\2\2G"+
"\u00d6\3\2\2\2I\u00f2\3\2\2\2K\u00f4\3\2\2\2M\u0108\3\2\2\2O\u010c\3\2"+
"\2\2Q\u0111\3\2\2\2S\u0118\3\2\2\2U\u0129\3\2\2\2W\u0137\3\2\2\2Y\u0148"+
"\3\2\2\2[\u0157\3\2\2\2]\u015a\3\2\2\2_\u0163\3\2\2\2a\u016a\3\2\2\2c"+
"\u016c\3\2\2\2e\u016e\3\2\2\2g\u0170\3\2\2\2i\u0177\3\2\2\2k\u0179\3\2"+
"\2\2m\u017c\3\2\2\2o\u0182\3\2\2\2q\u018d\3\2\2\2st\7}\2\2t\4\3\2\2\2"+
"uv\7\177\2\2v\6\3\2\2\2wx\7*\2\2x\b\3\2\2\2yz\7+\2\2z\n\3\2\2\2{|\7e\2"+
"\2|}\7q\2\2}~\7p\2\2~\177\7u\2\2\177\u0080\7v\2\2\u0080\f\3\2\2\2\u0081"+
"\u0082\7?\2\2\u0082\16\3\2\2\2\u0083\u0084\7=\2\2\u0084\20\3\2\2\2\u0085"+
"\u0086\7k\2\2\u0086\u0087\7h\2\2\u0087\22\3\2\2\2\u0088\u0089\7g\2\2\u0089"+
"\u008a\7n\2\2\u008a\u008b\7u\2\2\u008b\u008c\7g\2\2\u008c\24\3\2\2\2\u008d"+
"\u008e\7y\2\2\u008e\u008f\7j\2\2\u008f\u0090\7k\2\2\u0090\u0091\7n\2\2"+
"\u0091\u0092\7g\2\2\u0092\26\3\2\2\2\u0093\u0094\7f\2\2\u0094\u0095\7"+
"q\2\2\u0095\30\3\2\2\2\u0096\u0097\7t\2\2\u0097\u0098\7g\2\2\u0098\u0099"+
"\7v\2\2\u0099\u009a\7w\2\2\u009a\u009b\7t\2\2\u009b\u009c\7p\2\2\u009c"+
"\32\3\2\2\2\u009d\u009e\7.\2\2\u009e\34\3\2\2\2\u009f\u00a0\7,\2\2\u00a0"+
"\36\3\2\2\2\u00a1\u00a2\7]\2\2\u00a2 \3\2\2\2\u00a3\u00a4\7_\2\2\u00a4"+
"\"\3\2\2\2\u00a5\u00a6\7-\2\2\u00a6$\3\2\2\2\u00a7\u00a8\7/\2\2\u00a8"+
"&\3\2\2\2\u00a9\u00aa\7p\2\2\u00aa\u00ab\7q\2\2\u00ab\u00ac\7v\2\2\u00ac"+
"(\3\2\2\2\u00ad\u00ae\7#\2\2\u00ae*\3\2\2\2\u00af\u00b0\7(\2\2\u00b0,"+
"\3\2\2\2\u00b1\u00b2\7\61\2\2\u00b2.\3\2\2\2\u00b3\u00b4\7?\2\2\u00b4"+
"\u00b5\7?\2\2\u00b5\60\3\2\2\2\u00b6\u00b7\7#\2\2\u00b7\u00b8\7?\2\2\u00b8"+
"\62\3\2\2\2\u00b9\u00ba\7>\2\2\u00ba\u00bb\7@\2\2\u00bb\64\3\2\2\2\u00bc"+
"\u00bd\7>\2\2\u00bd\66\3\2\2\2\u00be\u00bf\7>\2\2\u00bf\u00c0\7?\2\2\u00c0"+
"8\3\2\2\2\u00c1\u00c2\7?\2\2\u00c2\u00c3\7>\2\2\u00c3:\3\2\2\2\u00c4\u00c5"+
"\7@\2\2\u00c5\u00c6\7?\2\2\u00c6<\3\2\2\2\u00c7\u00c8\7?\2\2\u00c8\u00c9"+
"\7@\2\2\u00c9>\3\2\2\2\u00ca\u00cb\7@\2\2\u00cb@\3\2\2\2\u00cc\u00cd\7"+
"c\2\2\u00cd\u00ce\7p\2\2\u00ce\u00cf\7f\2\2\u00cfB\3\2\2\2\u00d0\u00d1"+
"\7(\2\2\u00d1\u00d2\7(\2\2\u00d2D\3\2\2\2\u00d3\u00d4\7q\2\2\u00d4\u00d5"+
"\7t\2\2\u00d5F\3\2\2\2\u00d6\u00d7\7~\2\2\u00d7\u00d8\7~\2\2\u00d8H\3"+
"\2\2\2\u00d9\u00da\7d\2\2\u00da\u00db\7{\2\2\u00db\u00dc\7v\2\2\u00dc"+
"\u00f3\7g\2\2\u00dd\u00de\7y\2\2\u00de\u00df\7q\2\2\u00df\u00e0\7t\2\2"+
"\u00e0\u00f3\7f\2\2\u00e1\u00e2\7u\2\2\u00e2\u00e3\7v\2\2\u00e3\u00e4"+
"\7t\2\2\u00e4\u00e5\7k\2\2\u00e5\u00e6\7p\2\2\u00e6\u00f3\7i\2\2\u00e7"+
"\u00e8\7d\2\2\u00e8\u00e9\7q\2\2\u00e9\u00ea\7q\2\2\u00ea\u00eb\7n\2\2"+
"\u00eb\u00ec\7g\2\2\u00ec\u00ed\7c\2\2\u00ed\u00f3\7p\2\2\u00ee\u00ef"+
"\7x\2\2\u00ef\u00f0\7q\2\2\u00f0\u00f1\7k\2\2\u00f1\u00f3\7f\2\2\u00f2"+
"\u00d9\3\2\2\2\u00f2\u00dd\3\2\2\2\u00f2\u00e1\3\2\2\2\u00f2\u00e7\3\2"+
"\2\2\u00f2\u00ee\3\2\2\2\u00f3J\3\2\2\2\u00f4\u00fa\7$\2\2\u00f5\u00f6"+
"\7^\2\2\u00f6\u00f9\7$\2\2\u00f7\u00f9\n\2\2\2\u00f8\u00f5\3\2\2\2\u00f8"+
"\u00f7\3\2\2\2\u00f9\u00fc\3\2\2\2\u00fa\u00f8\3\2\2\2\u00fa\u00fb\3\2"+
"\2\2\u00fb\u00fd\3\2\2\2\u00fc\u00fa\3\2\2\2\u00fd\u00fe\7$\2\2\u00fe"+
"L\3\2\2\2\u00ff\u0100\7v\2\2\u0100\u0101\7t\2\2\u0101\u0102\7w\2\2\u0102"+
"\u0109\7g\2\2\u0103\u0104\7h\2\2\u0104\u0105\7c\2\2\u0105\u0106\7n\2\2"+
"\u0106\u0107\7u\2\2\u0107\u0109\7g\2\2\u0108\u00ff\3\2\2\2\u0108\u0103"+
"\3\2\2\2\u0109N\3\2\2\2\u010a\u010d\5Q)\2\u010b\u010d\5Y-\2\u010c\u010a"+
"\3\2\2\2\u010c\u010b\3\2\2\2\u010dP\3\2\2\2\u010e\u0112\5S*\2\u010f\u0112"+
"\5U+\2\u0110\u0112\5W,\2\u0111\u010e\3\2\2\2\u0111\u010f\3\2\2\2\u0111"+
"\u0110\3\2\2\2\u0112R\3\2\2\2\u0113\u0119\7\'\2\2\u0114\u0115\7\62\2\2"+
"\u0115\u0119\7d\2\2\u0116\u0117\7\62\2\2\u0117\u0119\7D\2\2\u0118\u0113"+
"\3\2\2\2\u0118\u0114\3\2\2\2\u0118\u0116\3\2\2\2\u0119\u011d\3\2\2\2\u011a"+
"\u011c\5a\61\2\u011b\u011a\3\2\2\2\u011c\u011f\3\2\2\2\u011d\u011b\3\2"+
"\2\2\u011d\u011e\3\2\2\2\u011e\u0120\3\2\2\2\u011f\u011d\3\2\2\2\u0120"+
"\u0122\7\60\2\2\u0121\u0123\5a\61\2\u0122\u0121\3\2\2\2\u0123\u0124\3"+
"\2\2\2\u0124\u0122\3\2\2\2\u0124\u0125\3\2\2\2\u0125T\3\2\2\2\u0126\u0128"+
"\5c\62\2\u0127\u0126\3\2\2\2\u0128\u012b\3\2\2\2\u0129\u0127\3\2\2\2\u0129"+
"\u012a\3\2\2\2\u012a\u012c\3\2\2\2\u012b\u0129\3\2\2\2\u012c\u012e\7\60"+
"\2\2\u012d\u012f\5c\62\2\u012e\u012d\3\2\2\2\u012f\u0130\3\2\2\2\u0130"+
"\u012e\3\2\2\2\u0130\u0131\3\2\2\2\u0131V\3\2\2\2\u0132\u0138\7&\2\2\u0133"+
"\u0134\7\62\2\2\u0134\u0138\7z\2\2\u0135\u0136\7\62\2\2\u0136\u0138\7"+
"Z\2\2\u0137\u0132\3\2\2\2\u0137\u0133\3\2\2\2\u0137\u0135\3\2\2\2\u0138"+
"\u013c\3\2\2\2\u0139\u013b\5e\63\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\u0141\7\60\2\2\u0140\u0142\5e\63\2\u0141\u0140\3"+
"\2\2\2\u0142\u0143\3\2\2\2\u0143\u0141\3\2\2\2\u0143\u0144\3\2\2\2\u0144"+
"X\3\2\2\2\u0145\u0149\5]/\2\u0146\u0149\5_\60\2\u0147\u0149\5[.\2\u0148"+
"\u0145\3\2\2\2\u0148\u0146\3\2\2\2\u0148\u0147\3\2\2\2\u0149Z\3\2\2\2"+
"\u014a\u014b\7\62\2\2\u014b\u014d\t\3\2\2\u014c\u014e\5a\61\2\u014d\u014c"+
"\3\2\2\2\u014e\u014f\3\2\2\2\u014f\u014d\3\2\2\2\u014f\u0150\3\2\2\2\u0150"+
"\u0158\3\2\2\2\u0151\u0153\7\'\2\2\u0152\u0154\5a\61\2\u0153\u0152\3\2"+
"\2\2\u0154\u0155\3\2\2\2\u0155\u0153\3\2\2\2\u0155\u0156\3\2\2\2\u0156"+
"\u0158\3\2\2\2\u0157\u014a\3\2\2\2\u0157\u0151\3\2\2\2\u0158\\\3\2\2\2"+
"\u0159\u015b\5c\62\2\u015a\u0159\3\2\2\2\u015b\u015c\3\2\2\2\u015c\u015a"+
"\3\2\2\2\u015c\u015d\3\2\2\2\u015d^\3\2\2\2\u015e\u0164\7&\2\2\u015f\u0160"+
"\7\62\2\2\u0160\u0164\7z\2\2\u0161\u0162\7\62\2\2\u0162\u0164\7Z\2\2\u0163"+
"\u015e\3\2\2\2\u0163\u015f\3\2\2\2\u0163\u0161\3\2\2\2\u0164\u0166\3\2"+
"\2\2\u0165\u0167\5e\63\2\u0166\u0165\3\2\2\2\u0167\u0168\3\2\2\2\u0168"+
"\u0166\3\2\2\2\u0168\u0169\3\2\2\2\u0169`\3\2\2\2\u016a\u016b\t\4\2\2"+
"\u016bb\3\2\2\2\u016c\u016d\t\5\2\2\u016dd\3\2\2\2\u016e\u016f\t\6\2\2"+
"\u016ff\3\2\2\2\u0170\u0174\5i\65\2\u0171\u0173\5k\66\2\u0172\u0171\3"+
"\2\2\2\u0173\u0176\3\2\2\2\u0174\u0172\3\2\2\2\u0174\u0175\3\2\2\2\u0175"+
"h\3\2\2\2\u0176\u0174\3\2\2\2\u0177\u0178\t\7\2\2\u0178j\3\2\2\2\u0179"+
"\u017a\t\b\2\2\u017al\3\2\2\2\u017b\u017d\t\t\2\2\u017c\u017b\3\2\2\2"+
"\u017d\u017e\3\2\2\2\u017e\u017c\3\2\2\2\u017e\u017f\3\2\2\2\u017f\u0180"+
"\3\2\2\2\u0180\u0181\b\67\2\2\u0181n\3\2\2\2\u0182\u0183\7\61\2\2\u0183"+
"\u0184\7\61\2\2\u0184\u0188\3\2\2\2\u0185\u0187\n\n\2\2\u0186\u0185\3"+
"\2\2\2\u0187\u018a\3\2\2\2\u0188\u0186\3\2\2\2\u0188\u0189\3\2\2\2\u0189"+
"\u018b\3\2\2\2\u018a\u0188\3\2\2\2\u018b\u018c\b8\2\2\u018cp\3\2\2\2\u018d"+
"\u018e\7\61\2\2\u018e\u018f\7,\2\2\u018f\u0193\3\2\2\2\u0190\u0192\13"+
"\2\2\2\u0191\u0190\3\2\2\2\u0192\u0195\3\2\2\2\u0193\u0194\3\2\2\2\u0193"+
"\u0191\3\2\2\2\u0194\u0196\3\2\2\2\u0195\u0193\3\2\2\2\u0196\u0197\7,"+
"\2\2\u0197\u0198\7\61\2\2\u0198\u0199\3\2\2\2\u0199\u019a\b9\2\2\u019a"+
"r\3\2\2\2\34\2\u00f2\u00f8\u00fa\u0108\u010c\u0111\u0118\u011d\u0124\u0129"+
"\u0130\u0137\u013c\u0143\u0148\u014f\u0155\u0157\u015c\u0163\u0168\u0174"+
"\u017e\u0188\u0193\3\b\2\2";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {

View File

@ -27,46 +27,60 @@ T__25=26
T__26=27
T__27=28
T__28=29
TYPE=30
STRING=31
BOOLEAN=32
NUMBER=33
NUMFLOAT=34
BINFLOAT=35
DECFLOAT=36
HEXFLOAT=37
NUMINT=38
BININTEGER=39
DECINTEGER=40
HEXINTEGER=41
NAME=42
WS=43
T__29=30
T__30=31
T__31=32
T__32=33
T__33=34
T__34=35
SIMPLETYPE=36
STRING=37
BOOLEAN=38
NUMBER=39
NUMFLOAT=40
BINFLOAT=41
DECFLOAT=42
HEXFLOAT=43
NUMINT=44
BININTEGER=45
DECINTEGER=46
HEXINTEGER=47
NAME=48
WS=49
COMMENT_LINE=50
COMMENT_BLOCK=51
'{'=1
'}'=2
'='=3
';'=4
'if'=5
'('=6
')'=7
'else'=8
'while'=9
'do'=10
'+'=11
'-'=12
'not'=13
'!'=14
'*'=15
'/'=16
'=='=17
'!='=18
'<>'=19
'<'=20
'<='=21
'=<'=22
'>='=23
'=>'=24
'>'=25
'and'=26
'&&'=27
'or'=28
'||'=29
'('=3
')'=4
'const'=5
'='=6
';'=7
'if'=8
'else'=9
'while'=10
'do'=11
'return'=12
','=13
'*'=14
'['=15
']'=16
'+'=17
'-'=18
'not'=19
'!'=20
'&'=21
'/'=22
'=='=23
'!='=24
'<>'=25
'<'=26
'<='=27
'=<'=28
'>='=29
'=>'=30
'>'=31
'and'=32
'&&'=33
'or'=34
'||'=35

View File

@ -39,6 +39,30 @@ public interface KickCListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitStmtBlock(KickCParser.StmtBlockContext ctx);
/**
* Enter a parse tree produced by the {@code stmtFunction}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
*/
void enterStmtFunction(KickCParser.StmtFunctionContext ctx);
/**
* Exit a parse tree produced by the {@code stmtFunction}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
*/
void exitStmtFunction(KickCParser.StmtFunctionContext ctx);
/**
* Enter a parse tree produced by the {@code stmtDeclaration}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
*/
void enterStmtDeclaration(KickCParser.StmtDeclarationContext ctx);
/**
* Exit a parse tree produced by the {@code stmtDeclaration}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
*/
void exitStmtDeclaration(KickCParser.StmtDeclarationContext ctx);
/**
* Enter a parse tree produced by the {@code stmtAssignment}
* labeled alternative in {@link KickCParser#stmt}.
@ -99,6 +123,170 @@ public interface KickCListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitStmtDoWhile(KickCParser.StmtDoWhileContext ctx);
/**
* Enter a parse tree produced by the {@code stmtReturn}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
*/
void enterStmtReturn(KickCParser.StmtReturnContext ctx);
/**
* Exit a parse tree produced by the {@code stmtReturn}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
*/
void exitStmtReturn(KickCParser.StmtReturnContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#parameterListDecl}.
* @param ctx the parse tree
*/
void enterParameterListDecl(KickCParser.ParameterListDeclContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#parameterListDecl}.
* @param ctx the parse tree
*/
void exitParameterListDecl(KickCParser.ParameterListDeclContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#parameterDecl}.
* @param ctx the parse tree
*/
void enterParameterDecl(KickCParser.ParameterDeclContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#parameterDecl}.
* @param ctx the parse tree
*/
void exitParameterDecl(KickCParser.ParameterDeclContext ctx);
/**
* Enter a parse tree produced by the {@code typePtr}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypePtr(KickCParser.TypePtrContext ctx);
/**
* Exit a parse tree produced by the {@code typePtr}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypePtr(KickCParser.TypePtrContext ctx);
/**
* Enter a parse tree produced by the {@code typeArray}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeArray(KickCParser.TypeArrayContext ctx);
/**
* Exit a parse tree produced by the {@code typeArray}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeArray(KickCParser.TypeArrayContext ctx);
/**
* Enter a parse tree produced by the {@code typeSimple}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeSimple(KickCParser.TypeSimpleContext ctx);
/**
* Exit a parse tree produced by the {@code typeSimple}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeSimple(KickCParser.TypeSimpleContext ctx);
/**
* Enter a parse tree produced by the {@code initExpr}
* labeled alternative in {@link KickCParser#initializer}.
* @param ctx the parse tree
*/
void enterInitExpr(KickCParser.InitExprContext ctx);
/**
* Exit a parse tree produced by the {@code initExpr}
* labeled alternative in {@link KickCParser#initializer}.
* @param ctx the parse tree
*/
void exitInitExpr(KickCParser.InitExprContext ctx);
/**
* Enter a parse tree produced by the {@code initList}
* labeled alternative in {@link KickCParser#initializer}.
* @param ctx the parse tree
*/
void enterInitList(KickCParser.InitListContext ctx);
/**
* Exit a parse tree produced by the {@code initList}
* labeled alternative in {@link KickCParser#initializer}.
* @param ctx the parse tree
*/
void exitInitList(KickCParser.InitListContext ctx);
/**
* Enter a parse tree produced by the {@code lvalueName}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
*/
void enterLvalueName(KickCParser.LvalueNameContext ctx);
/**
* Exit a parse tree produced by the {@code lvalueName}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
*/
void exitLvalueName(KickCParser.LvalueNameContext ctx);
/**
* Enter a parse tree produced by the {@code lvaluePtr}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
*/
void enterLvaluePtr(KickCParser.LvaluePtrContext ctx);
/**
* Exit a parse tree produced by the {@code lvaluePtr}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
*/
void exitLvaluePtr(KickCParser.LvaluePtrContext ctx);
/**
* Enter a parse tree produced by the {@code lvalueArray}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
*/
void enterLvalueArray(KickCParser.LvalueArrayContext ctx);
/**
* Exit a parse tree produced by the {@code lvalueArray}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
*/
void exitLvalueArray(KickCParser.LvalueArrayContext ctx);
/**
* Enter a parse tree produced by the {@code lvaluePar}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
*/
void enterLvaluePar(KickCParser.LvalueParContext ctx);
/**
* Exit a parse tree produced by the {@code lvaluePar}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
*/
void exitLvaluePar(KickCParser.LvalueParContext ctx);
/**
* Enter a parse tree produced by the {@code exprCast}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
*/
void enterExprCast(KickCParser.ExprCastContext ctx);
/**
* Exit a parse tree produced by the {@code exprCast}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
*/
void exitExprCast(KickCParser.ExprCastContext ctx);
/**
* Enter a parse tree produced by the {@code exprCall}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
*/
void enterExprCall(KickCParser.ExprCallContext ctx);
/**
* Exit a parse tree produced by the {@code exprCall}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
*/
void exitExprCall(KickCParser.ExprCallContext ctx);
/**
* Enter a parse tree produced by the {@code exprBinary}
* labeled alternative in {@link KickCParser#expr}.
@ -183,4 +371,26 @@ public interface KickCListener extends ParseTreeListener {
* @param ctx the parse tree
*/
void exitExprNumber(KickCParser.ExprNumberContext ctx);
/**
* Enter a parse tree produced by the {@code exprArray}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
*/
void enterExprArray(KickCParser.ExprArrayContext ctx);
/**
* Exit a parse tree produced by the {@code exprArray}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
*/
void exitExprArray(KickCParser.ExprArrayContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#parameterList}.
* @param ctx the parse tree
*/
void enterParameterList(KickCParser.ParameterListContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#parameterList}.
* @param ctx the parse tree
*/
void exitParameterList(KickCParser.ParameterListContext ctx);
}

File diff suppressed because it is too large Load Diff

View File

@ -29,6 +29,20 @@ public interface KickCVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitStmtBlock(KickCParser.StmtBlockContext ctx);
/**
* Visit a parse tree produced by the {@code stmtFunction}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStmtFunction(KickCParser.StmtFunctionContext ctx);
/**
* Visit a parse tree produced by the {@code stmtDeclaration}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStmtDeclaration(KickCParser.StmtDeclarationContext ctx);
/**
* Visit a parse tree produced by the {@code stmtAssignment}
* labeled alternative in {@link KickCParser#stmt}.
@ -64,6 +78,102 @@ public interface KickCVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitStmtDoWhile(KickCParser.StmtDoWhileContext ctx);
/**
* Visit a parse tree produced by the {@code stmtReturn}
* labeled alternative in {@link KickCParser#stmt}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStmtReturn(KickCParser.StmtReturnContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#parameterListDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParameterListDecl(KickCParser.ParameterListDeclContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#parameterDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParameterDecl(KickCParser.ParameterDeclContext ctx);
/**
* Visit a parse tree produced by the {@code typePtr}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypePtr(KickCParser.TypePtrContext ctx);
/**
* Visit a parse tree produced by the {@code typeArray}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeArray(KickCParser.TypeArrayContext ctx);
/**
* Visit a parse tree produced by the {@code typeSimple}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSimple(KickCParser.TypeSimpleContext ctx);
/**
* Visit a parse tree produced by the {@code initExpr}
* labeled alternative in {@link KickCParser#initializer}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInitExpr(KickCParser.InitExprContext ctx);
/**
* Visit a parse tree produced by the {@code initList}
* labeled alternative in {@link KickCParser#initializer}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInitList(KickCParser.InitListContext ctx);
/**
* Visit a parse tree produced by the {@code lvalueName}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLvalueName(KickCParser.LvalueNameContext ctx);
/**
* Visit a parse tree produced by the {@code lvaluePtr}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLvaluePtr(KickCParser.LvaluePtrContext ctx);
/**
* Visit a parse tree produced by the {@code lvalueArray}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLvalueArray(KickCParser.LvalueArrayContext ctx);
/**
* Visit a parse tree produced by the {@code lvaluePar}
* labeled alternative in {@link KickCParser#lvalue}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLvaluePar(KickCParser.LvalueParContext ctx);
/**
* Visit a parse tree produced by the {@code exprCast}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExprCast(KickCParser.ExprCastContext ctx);
/**
* Visit a parse tree produced by the {@code exprCall}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExprCall(KickCParser.ExprCallContext ctx);
/**
* Visit a parse tree produced by the {@code exprBinary}
* labeled alternative in {@link KickCParser#expr}.
@ -113,4 +223,17 @@ public interface KickCVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result
*/
T visitExprNumber(KickCParser.ExprNumberContext ctx);
/**
* Visit a parse tree produced by the {@code exprArray}
* labeled alternative in {@link KickCParser#expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExprArray(KickCParser.ExprArrayContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#parameterList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParameterList(KickCParser.ParameterListContext ctx);
}

View File

@ -13,7 +13,7 @@ import java.util.List;
/** Test my KickC Grammar */
public class Main {
public static void main(String[] args) throws IOException {
final String fileName = "src/dk/camelot64/kickc/test/fib2.kc";
final String fileName = "src/dk/camelot64/kickc/test/fib.kc";
final CharStream input = CharStreams.fromFileName(fileName);
System.out.println(input.toString());
KickCLexer lexer = new KickCLexer(input);

View File

@ -1,7 +1,7 @@
byte n1 = 0;
byte n2 = 1;
byte i = 12;
byte fib = 0;
byte i = 12;
do {
fib = n1 + n2;
n1 = n2;

View File

@ -0,0 +1,12 @@
// Array declaration & allocation (allocated in same memory space as the program)
byte[64] idtab;
// Array assignment
idtab[0] = 12;
// Using array indexing
byte id6 = idtab[1];