1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-09-29 03:56:15 +00:00

Added support for typedef arrays.

This commit is contained in:
jespergravgaard 2020-03-27 22:23:04 +01:00
parent d6c60d9466
commit 838b8f4d26
13 changed files with 3417 additions and 3052 deletions

View File

@ -48,12 +48,8 @@ decl
| typeDef ';' | typeDef ';'
; ;
declTypes
: directive* typeDecl directive*
;
declVariables declVariables
: declTypes declVariableList : declType declVariableList
; ;
declVariableList declVariableList
@ -61,33 +57,84 @@ declVariableList
| declVariableList COMMA declPointer* declVariableInit | declVariableList COMMA declPointer* declVariableInit
; ;
typeDef
: TYPEDEF declType declPointer* NAME declArray* {cParser.addTypedef($NAME.text);}
;
declVariableInit
: NAME declArray* ('=' expr)? #declVariableInitExpr
| NAME declArray* '=' declKasm #declVariableInitKasm
;
declType
: directive* type directive*
;
declPointer declPointer
: ASTERISK directive* : ASTERISK directive*
; ;
typeDef declArray
: TYPEDEF declTypes declPointer* NAME {cParser.addTypedef($NAME.text);} : BRACKET_BEGIN (expr)? BRACKET_END
; ;
declVariableInit typeSpecifier
: declVariable ('=' expr)? #declVariableInitExpr : type #typeSpecifierSimple
| declVariable '=' declKasm #declVariableInitKasm | typeSpecifier ASTERISK #typeSpecifierPointer
| typeSpecifier BRACKET_BEGIN (expr)? BRACKET_END #typeSpecifierArray
; ;
declVariable type
: NAME #declVariableName : PAR_BEGIN type PAR_END #typePar
| declVariable BRACKET_BEGIN (expr)? BRACKET_END #declVariableArray | SIMPLETYPE #typeSimple
| SIGNEDNESS SIMPLETYPE? #typeSignedSimple
| type BRACKET_BEGIN (expr)? BRACKET_END #typeArray
| type PAR_BEGIN PAR_END #typeProcedure
| structDef #typeStructDef
| structRef #typeStructRef
| enumDef #typeEnumDef
| enumRef #typeEnumRef
| TYPEDEFNAME #typeNamedRef
;
structRef
: STRUCT NAME
;
structDef
: STRUCT NAME? CURLY_BEGIN structMembers+ CURLY_END
;
structMembers
: declVariables ';'
;
enumRef
: ENUM NAME
;
enumDef
: ENUM NAME? CURLY_BEGIN enumMemberList CURLY_END
;
enumMemberList
: enumMember
| enumMemberList COMMA enumMember
;
enumMember
: NAME ( '=' expr )?
; ;
declFunction declFunction
: declTypes declPointer* NAME PAR_BEGIN parameterListDecl? PAR_END CURLY_BEGIN stmtSeq? CURLY_END : declType declPointer* NAME PAR_BEGIN parameterListDecl? PAR_END CURLY_BEGIN stmtSeq? CURLY_END
; ;
parameterListDecl parameterListDecl
: parameterDecl (COMMA parameterDecl)* ; : parameterDecl (COMMA parameterDecl)* ;
parameterDecl parameterDecl
: declTypes declPointer* NAME #parameterDeclType : declType declPointer* NAME #parameterDeclType
| SIMPLETYPE #parameterDeclVoid | SIMPLETYPE #parameterDeclVoid
; ;
@ -153,7 +200,7 @@ switchCase:
forLoop forLoop
: forClassicInit ';' commaExpr ';' commaExpr? #forClassic : forClassicInit ';' commaExpr ';' commaExpr? #forClassic
| (declTypes declPointer*)? NAME COLON expr '..' expr #forRange | (declType declPointer*)? NAME COLON expr '..' expr #forRange
; ;
forClassicInit forClassicInit
@ -161,54 +208,6 @@ forClassicInit
| commaExpr #forClassicInitExpr | commaExpr #forClassicInitExpr
; ;
typeDecl
: PAR_BEGIN typeDecl PAR_END #typePar
| SIMPLETYPE #typeSimple
| SIGNEDNESS SIMPLETYPE? #typeSignedSimple
| typeDecl BRACKET_BEGIN (expr)? BRACKET_END #typeArray
| typeDecl PAR_BEGIN PAR_END #typeProcedure
| structDef #typeStructDef
| structRef #typeStructRef
| enumDef #typeEnumDef
| enumRef #typeEnumRef
| TYPEDEFNAME #typeNamedRef
;
typeSpecifier
: typeDecl #typeSpecifierSimple
| typeSpecifier ASTERISK #typeSpecifierPointer
| typeSpecifier BRACKET_BEGIN (expr)? BRACKET_END #typeSpecifierArray
;
structRef
: STRUCT NAME
;
structDef
: STRUCT NAME? CURLY_BEGIN structMembers+ CURLY_END
;
structMembers
: declVariables ';'
;
enumRef
: ENUM NAME
;
enumDef
: ENUM NAME? CURLY_BEGIN enumMemberList CURLY_END
;
enumMemberList
: enumMember
| enumMemberList COMMA enumMember
;
enumMember
: NAME ( '=' expr )?
;
commaExpr commaExpr
: expr #commaNone : expr #commaNone
| commaExpr COMMA expr #commaSimple | commaExpr COMMA expr #commaSimple

File diff suppressed because it is too large Load Diff

View File

@ -85,18 +85,6 @@ public class KickCParserBaseListener implements KickCParserListener {
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void exitDecl(KickCParser.DeclContext ctx) { } @Override public void exitDecl(KickCParser.DeclContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDeclTypes(KickCParser.DeclTypesContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDeclTypes(KickCParser.DeclTypesContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
@ -121,18 +109,6 @@ public class KickCParserBaseListener implements KickCParserListener {
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void exitDeclVariableList(KickCParser.DeclVariableListContext ctx) { } @Override public void exitDeclVariableList(KickCParser.DeclVariableListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDeclPointer(KickCParser.DeclPointerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDeclPointer(KickCParser.DeclPointerContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
@ -174,25 +150,277 @@ public class KickCParserBaseListener implements KickCParserListener {
* *
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void enterDeclVariableArray(KickCParser.DeclVariableArrayContext ctx) { } @Override public void enterDeclType(KickCParser.DeclTypeContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void exitDeclVariableArray(KickCParser.DeclVariableArrayContext ctx) { } @Override public void exitDeclType(KickCParser.DeclTypeContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void enterDeclVariableName(KickCParser.DeclVariableNameContext ctx) { } @Override public void enterDeclPointer(KickCParser.DeclPointerContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void exitDeclVariableName(KickCParser.DeclVariableNameContext ctx) { } @Override public void exitDeclPointer(KickCParser.DeclPointerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterDeclArray(KickCParser.DeclArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitDeclArray(KickCParser.DeclArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypePar(KickCParser.TypeParContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypePar(KickCParser.TypeParContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeProcedure(KickCParser.TypeProcedureContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeProcedure(KickCParser.TypeProcedureContext 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 enterTypeStructRef(KickCParser.TypeStructRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeStructRef(KickCParser.TypeStructRefContext 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 enterTypeStructDef(KickCParser.TypeStructDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeStructDef(KickCParser.TypeStructDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeNamedRef(KickCParser.TypeNamedRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeNamedRef(KickCParser.TypeNamedRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeEnumRef(KickCParser.TypeEnumRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeEnumRef(KickCParser.TypeEnumRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeEnumDef(KickCParser.TypeEnumDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeEnumDef(KickCParser.TypeEnumDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStructRef(KickCParser.StructRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStructRef(KickCParser.StructRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStructDef(KickCParser.StructDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStructDef(KickCParser.StructDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStructMembers(KickCParser.StructMembersContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStructMembers(KickCParser.StructMembersContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEnumRef(KickCParser.EnumRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEnumRef(KickCParser.EnumRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEnumDef(KickCParser.EnumDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEnumDef(KickCParser.EnumDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEnumMemberList(KickCParser.EnumMemberListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEnumMemberList(KickCParser.EnumMemberListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEnumMember(KickCParser.EnumMemberContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEnumMember(KickCParser.EnumMemberContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
@ -793,246 +1021,6 @@ public class KickCParserBaseListener implements KickCParserListener {
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void exitForClassicInitExpr(KickCParser.ForClassicInitExprContext ctx) { } @Override public void exitForClassicInitExpr(KickCParser.ForClassicInitExprContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypePar(KickCParser.TypeParContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypePar(KickCParser.TypeParContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeProcedure(KickCParser.TypeProcedureContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeProcedure(KickCParser.TypeProcedureContext 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 enterTypeStructRef(KickCParser.TypeStructRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeStructRef(KickCParser.TypeStructRefContext 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 enterTypeStructDef(KickCParser.TypeStructDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeStructDef(KickCParser.TypeStructDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeNamedRef(KickCParser.TypeNamedRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeNamedRef(KickCParser.TypeNamedRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeEnumRef(KickCParser.TypeEnumRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeEnumRef(KickCParser.TypeEnumRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeEnumDef(KickCParser.TypeEnumDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeEnumDef(KickCParser.TypeEnumDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStructRef(KickCParser.StructRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStructRef(KickCParser.StructRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStructDef(KickCParser.StructDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStructDef(KickCParser.StructDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterStructMembers(KickCParser.StructMembersContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitStructMembers(KickCParser.StructMembersContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEnumRef(KickCParser.EnumRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEnumRef(KickCParser.EnumRefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEnumDef(KickCParser.EnumDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEnumDef(KickCParser.EnumDefContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEnumMemberList(KickCParser.EnumMemberListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEnumMemberList(KickCParser.EnumMemberListContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterEnumMember(KickCParser.EnumMemberContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitEnumMember(KickCParser.EnumMemberContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@ -55,13 +55,6 @@ public class KickCParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> imple
* {@link #visitChildren} on {@code ctx}.</p> * {@link #visitChildren} on {@code ctx}.</p>
*/ */
@Override public T visitDecl(KickCParser.DeclContext ctx) { return visitChildren(ctx); } @Override public T visitDecl(KickCParser.DeclContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDeclTypes(KickCParser.DeclTypesContext ctx) { return visitChildren(ctx); }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
@ -76,13 +69,6 @@ public class KickCParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> imple
* {@link #visitChildren} on {@code ctx}.</p> * {@link #visitChildren} on {@code ctx}.</p>
*/ */
@Override public T visitDeclVariableList(KickCParser.DeclVariableListContext ctx) { return visitChildren(ctx); } @Override public T visitDeclVariableList(KickCParser.DeclVariableListContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDeclPointer(KickCParser.DeclPointerContext ctx) { return visitChildren(ctx); }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
@ -110,14 +96,161 @@ public class KickCParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> imple
* <p>The default implementation returns the result of calling * <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p> * {@link #visitChildren} on {@code ctx}.</p>
*/ */
@Override public T visitDeclVariableArray(KickCParser.DeclVariableArrayContext ctx) { return visitChildren(ctx); } @Override public T visitDeclType(KickCParser.DeclTypeContext ctx) { return visitChildren(ctx); }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
* <p>The default implementation returns the result of calling * <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p> * {@link #visitChildren} on {@code ctx}.</p>
*/ */
@Override public T visitDeclVariableName(KickCParser.DeclVariableNameContext ctx) { return visitChildren(ctx); } @Override public T visitDeclPointer(KickCParser.DeclPointerContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitDeclArray(KickCParser.DeclArrayContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypePar(KickCParser.TypeParContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeProcedure(KickCParser.TypeProcedureContext 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 visitTypeStructRef(KickCParser.TypeStructRefContext 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 visitTypeStructDef(KickCParser.TypeStructDefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeNamedRef(KickCParser.TypeNamedRefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeEnumRef(KickCParser.TypeEnumRefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeEnumDef(KickCParser.TypeEnumDefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStructRef(KickCParser.StructRefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStructDef(KickCParser.StructDefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStructMembers(KickCParser.StructMembersContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEnumRef(KickCParser.EnumRefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEnumDef(KickCParser.EnumDefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEnumMemberList(KickCParser.EnumMemberListContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEnumMember(KickCParser.EnumMemberContext ctx) { return visitChildren(ctx); }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *
@ -468,146 +601,6 @@ public class KickCParserBaseVisitor<T> extends AbstractParseTreeVisitor<T> imple
* {@link #visitChildren} on {@code ctx}.</p> * {@link #visitChildren} on {@code ctx}.</p>
*/ */
@Override public T visitForClassicInitExpr(KickCParser.ForClassicInitExprContext ctx) { return visitChildren(ctx); } @Override public T visitForClassicInitExpr(KickCParser.ForClassicInitExprContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypePar(KickCParser.TypeParContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeProcedure(KickCParser.TypeProcedureContext 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 visitTypeStructRef(KickCParser.TypeStructRefContext 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 visitTypeStructDef(KickCParser.TypeStructDefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeNamedRef(KickCParser.TypeNamedRefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeEnumRef(KickCParser.TypeEnumRefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeEnumDef(KickCParser.TypeEnumDefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStructRef(KickCParser.StructRefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStructDef(KickCParser.StructDefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitStructMembers(KickCParser.StructMembersContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEnumRef(KickCParser.EnumRefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEnumDef(KickCParser.EnumDefContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEnumMemberList(KickCParser.EnumMemberListContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitEnumMember(KickCParser.EnumMemberContext ctx) { return visitChildren(ctx); }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@ -69,16 +69,6 @@ public interface KickCParserListener extends ParseTreeListener {
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void exitDecl(KickCParser.DeclContext ctx); void exitDecl(KickCParser.DeclContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#declTypes}.
* @param ctx the parse tree
*/
void enterDeclTypes(KickCParser.DeclTypesContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#declTypes}.
* @param ctx the parse tree
*/
void exitDeclTypes(KickCParser.DeclTypesContext ctx);
/** /**
* Enter a parse tree produced by {@link KickCParser#declVariables}. * Enter a parse tree produced by {@link KickCParser#declVariables}.
* @param ctx the parse tree * @param ctx the parse tree
@ -99,16 +89,6 @@ public interface KickCParserListener extends ParseTreeListener {
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void exitDeclVariableList(KickCParser.DeclVariableListContext ctx); void exitDeclVariableList(KickCParser.DeclVariableListContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#declPointer}.
* @param ctx the parse tree
*/
void enterDeclPointer(KickCParser.DeclPointerContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#declPointer}.
* @param ctx the parse tree
*/
void exitDeclPointer(KickCParser.DeclPointerContext ctx);
/** /**
* Enter a parse tree produced by {@link KickCParser#typeDef}. * Enter a parse tree produced by {@link KickCParser#typeDef}.
* @param ctx the parse tree * @param ctx the parse tree
@ -144,29 +124,261 @@ public interface KickCParserListener extends ParseTreeListener {
*/ */
void exitDeclVariableInitKasm(KickCParser.DeclVariableInitKasmContext ctx); void exitDeclVariableInitKasm(KickCParser.DeclVariableInitKasmContext ctx);
/** /**
* Enter a parse tree produced by the {@code declVariableArray} * Enter a parse tree produced by {@link KickCParser#declType}.
* labeled alternative in {@link KickCParser#declVariable}.
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void enterDeclVariableArray(KickCParser.DeclVariableArrayContext ctx); void enterDeclType(KickCParser.DeclTypeContext ctx);
/** /**
* Exit a parse tree produced by the {@code declVariableArray} * Exit a parse tree produced by {@link KickCParser#declType}.
* labeled alternative in {@link KickCParser#declVariable}.
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void exitDeclVariableArray(KickCParser.DeclVariableArrayContext ctx); void exitDeclType(KickCParser.DeclTypeContext ctx);
/** /**
* Enter a parse tree produced by the {@code declVariableName} * Enter a parse tree produced by {@link KickCParser#declPointer}.
* labeled alternative in {@link KickCParser#declVariable}.
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void enterDeclVariableName(KickCParser.DeclVariableNameContext ctx); void enterDeclPointer(KickCParser.DeclPointerContext ctx);
/** /**
* Exit a parse tree produced by the {@code declVariableName} * Exit a parse tree produced by {@link KickCParser#declPointer}.
* labeled alternative in {@link KickCParser#declVariable}.
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void exitDeclVariableName(KickCParser.DeclVariableNameContext ctx); void exitDeclPointer(KickCParser.DeclPointerContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#declArray}.
* @param ctx the parse tree
*/
void enterDeclArray(KickCParser.DeclArrayContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#declArray}.
* @param ctx the parse tree
*/
void exitDeclArray(KickCParser.DeclArrayContext ctx);
/**
* Enter a parse tree produced by the {@code typeSpecifierSimple}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void enterTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx);
/**
* Exit a parse tree produced by the {@code typeSpecifierSimple}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void exitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx);
/**
* Enter a parse tree produced by the {@code typeSpecifierPointer}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void enterTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx);
/**
* Exit a parse tree produced by the {@code typeSpecifierPointer}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void exitTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx);
/**
* Enter a parse tree produced by the {@code typeSpecifierArray}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void enterTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx);
/**
* Exit a parse tree produced by the {@code typeSpecifierArray}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void exitTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx);
/**
* Enter a parse tree produced by the {@code typePar}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypePar(KickCParser.TypeParContext ctx);
/**
* Exit a parse tree produced by the {@code typePar}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypePar(KickCParser.TypeParContext ctx);
/**
* Enter a parse tree produced by the {@code typeProcedure}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeProcedure(KickCParser.TypeProcedureContext ctx);
/**
* Exit a parse tree produced by the {@code typeProcedure}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeProcedure(KickCParser.TypeProcedureContext ctx);
/**
* Enter a parse tree produced by the {@code typeArray}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeArray(KickCParser.TypeArrayContext ctx);
/**
* Exit a parse tree produced by the {@code typeArray}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeArray(KickCParser.TypeArrayContext ctx);
/**
* Enter a parse tree produced by the {@code typeStructRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeStructRef(KickCParser.TypeStructRefContext ctx);
/**
* Exit a parse tree produced by the {@code typeStructRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeStructRef(KickCParser.TypeStructRefContext ctx);
/**
* Enter a parse tree produced by the {@code typeSimple}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeSimple(KickCParser.TypeSimpleContext ctx);
/**
* Exit a parse tree produced by the {@code typeSimple}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeSimple(KickCParser.TypeSimpleContext ctx);
/**
* Enter a parse tree produced by the {@code typeStructDef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeStructDef(KickCParser.TypeStructDefContext ctx);
/**
* Exit a parse tree produced by the {@code typeStructDef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeStructDef(KickCParser.TypeStructDefContext ctx);
/**
* Enter a parse tree produced by the {@code typeNamedRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeNamedRef(KickCParser.TypeNamedRefContext ctx);
/**
* Exit a parse tree produced by the {@code typeNamedRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeNamedRef(KickCParser.TypeNamedRefContext ctx);
/**
* Enter a parse tree produced by the {@code typeSignedSimple}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx);
/**
* Exit a parse tree produced by the {@code typeSignedSimple}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx);
/**
* Enter a parse tree produced by the {@code typeEnumRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeEnumRef(KickCParser.TypeEnumRefContext ctx);
/**
* Exit a parse tree produced by the {@code typeEnumRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeEnumRef(KickCParser.TypeEnumRefContext ctx);
/**
* Enter a parse tree produced by the {@code typeEnumDef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void enterTypeEnumDef(KickCParser.TypeEnumDefContext ctx);
/**
* Exit a parse tree produced by the {@code typeEnumDef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
*/
void exitTypeEnumDef(KickCParser.TypeEnumDefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#structRef}.
* @param ctx the parse tree
*/
void enterStructRef(KickCParser.StructRefContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#structRef}.
* @param ctx the parse tree
*/
void exitStructRef(KickCParser.StructRefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#structDef}.
* @param ctx the parse tree
*/
void enterStructDef(KickCParser.StructDefContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#structDef}.
* @param ctx the parse tree
*/
void exitStructDef(KickCParser.StructDefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#structMembers}.
* @param ctx the parse tree
*/
void enterStructMembers(KickCParser.StructMembersContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#structMembers}.
* @param ctx the parse tree
*/
void exitStructMembers(KickCParser.StructMembersContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#enumRef}.
* @param ctx the parse tree
*/
void enterEnumRef(KickCParser.EnumRefContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#enumRef}.
* @param ctx the parse tree
*/
void exitEnumRef(KickCParser.EnumRefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#enumDef}.
* @param ctx the parse tree
*/
void enterEnumDef(KickCParser.EnumDefContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#enumDef}.
* @param ctx the parse tree
*/
void exitEnumDef(KickCParser.EnumDefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#enumMemberList}.
* @param ctx the parse tree
*/
void enterEnumMemberList(KickCParser.EnumMemberListContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#enumMemberList}.
* @param ctx the parse tree
*/
void exitEnumMemberList(KickCParser.EnumMemberListContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#enumMember}.
* @param ctx the parse tree
*/
void enterEnumMember(KickCParser.EnumMemberContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#enumMember}.
* @param ctx the parse tree
*/
void exitEnumMember(KickCParser.EnumMemberContext ctx);
/** /**
* Enter a parse tree produced by {@link KickCParser#declFunction}. * Enter a parse tree produced by {@link KickCParser#declFunction}.
* @param ctx the parse tree * @param ctx the parse tree
@ -757,232 +969,6 @@ public interface KickCParserListener extends ParseTreeListener {
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void exitForClassicInitExpr(KickCParser.ForClassicInitExprContext ctx); void exitForClassicInitExpr(KickCParser.ForClassicInitExprContext ctx);
/**
* Enter a parse tree produced by the {@code typePar}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypePar(KickCParser.TypeParContext ctx);
/**
* Exit a parse tree produced by the {@code typePar}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypePar(KickCParser.TypeParContext ctx);
/**
* Enter a parse tree produced by the {@code typeProcedure}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeProcedure(KickCParser.TypeProcedureContext ctx);
/**
* Exit a parse tree produced by the {@code typeProcedure}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeProcedure(KickCParser.TypeProcedureContext 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 typeStructRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeStructRef(KickCParser.TypeStructRefContext ctx);
/**
* Exit a parse tree produced by the {@code typeStructRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeStructRef(KickCParser.TypeStructRefContext 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 typeStructDef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeStructDef(KickCParser.TypeStructDefContext ctx);
/**
* Exit a parse tree produced by the {@code typeStructDef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeStructDef(KickCParser.TypeStructDefContext ctx);
/**
* Enter a parse tree produced by the {@code typeNamedRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeNamedRef(KickCParser.TypeNamedRefContext ctx);
/**
* Exit a parse tree produced by the {@code typeNamedRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeNamedRef(KickCParser.TypeNamedRefContext ctx);
/**
* Enter a parse tree produced by the {@code typeSignedSimple}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx);
/**
* Exit a parse tree produced by the {@code typeSignedSimple}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx);
/**
* Enter a parse tree produced by the {@code typeEnumRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeEnumRef(KickCParser.TypeEnumRefContext ctx);
/**
* Exit a parse tree produced by the {@code typeEnumRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeEnumRef(KickCParser.TypeEnumRefContext ctx);
/**
* Enter a parse tree produced by the {@code typeEnumDef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void enterTypeEnumDef(KickCParser.TypeEnumDefContext ctx);
/**
* Exit a parse tree produced by the {@code typeEnumDef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
*/
void exitTypeEnumDef(KickCParser.TypeEnumDefContext ctx);
/**
* Enter a parse tree produced by the {@code typeSpecifierSimple}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void enterTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx);
/**
* Exit a parse tree produced by the {@code typeSpecifierSimple}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void exitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx);
/**
* Enter a parse tree produced by the {@code typeSpecifierPointer}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void enterTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx);
/**
* Exit a parse tree produced by the {@code typeSpecifierPointer}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void exitTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx);
/**
* Enter a parse tree produced by the {@code typeSpecifierArray}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void enterTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx);
/**
* Exit a parse tree produced by the {@code typeSpecifierArray}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
*/
void exitTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#structRef}.
* @param ctx the parse tree
*/
void enterStructRef(KickCParser.StructRefContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#structRef}.
* @param ctx the parse tree
*/
void exitStructRef(KickCParser.StructRefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#structDef}.
* @param ctx the parse tree
*/
void enterStructDef(KickCParser.StructDefContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#structDef}.
* @param ctx the parse tree
*/
void exitStructDef(KickCParser.StructDefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#structMembers}.
* @param ctx the parse tree
*/
void enterStructMembers(KickCParser.StructMembersContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#structMembers}.
* @param ctx the parse tree
*/
void exitStructMembers(KickCParser.StructMembersContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#enumRef}.
* @param ctx the parse tree
*/
void enterEnumRef(KickCParser.EnumRefContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#enumRef}.
* @param ctx the parse tree
*/
void exitEnumRef(KickCParser.EnumRefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#enumDef}.
* @param ctx the parse tree
*/
void enterEnumDef(KickCParser.EnumDefContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#enumDef}.
* @param ctx the parse tree
*/
void exitEnumDef(KickCParser.EnumDefContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#enumMemberList}.
* @param ctx the parse tree
*/
void enterEnumMemberList(KickCParser.EnumMemberListContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#enumMemberList}.
* @param ctx the parse tree
*/
void exitEnumMemberList(KickCParser.EnumMemberListContext ctx);
/**
* Enter a parse tree produced by {@link KickCParser#enumMember}.
* @param ctx the parse tree
*/
void enterEnumMember(KickCParser.EnumMemberContext ctx);
/**
* Exit a parse tree produced by {@link KickCParser#enumMember}.
* @param ctx the parse tree
*/
void exitEnumMember(KickCParser.EnumMemberContext ctx);
/** /**
* Enter a parse tree produced by the {@code commaNone} * Enter a parse tree produced by the {@code commaNone}
* labeled alternative in {@link KickCParser#commaExpr}. * labeled alternative in {@link KickCParser#commaExpr}.

View File

@ -48,12 +48,6 @@ public interface KickCParserVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result * @return the visitor result
*/ */
T visitDecl(KickCParser.DeclContext ctx); T visitDecl(KickCParser.DeclContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#declTypes}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeclTypes(KickCParser.DeclTypesContext ctx);
/** /**
* Visit a parse tree produced by {@link KickCParser#declVariables}. * Visit a parse tree produced by {@link KickCParser#declVariables}.
* @param ctx the parse tree * @param ctx the parse tree
@ -66,12 +60,6 @@ public interface KickCParserVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result * @return the visitor result
*/ */
T visitDeclVariableList(KickCParser.DeclVariableListContext ctx); T visitDeclVariableList(KickCParser.DeclVariableListContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#declPointer}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeclPointer(KickCParser.DeclPointerContext ctx);
/** /**
* Visit a parse tree produced by {@link KickCParser#typeDef}. * Visit a parse tree produced by {@link KickCParser#typeDef}.
* @param ctx the parse tree * @param ctx the parse tree
@ -93,19 +81,156 @@ public interface KickCParserVisitor<T> extends ParseTreeVisitor<T> {
*/ */
T visitDeclVariableInitKasm(KickCParser.DeclVariableInitKasmContext ctx); T visitDeclVariableInitKasm(KickCParser.DeclVariableInitKasmContext ctx);
/** /**
* Visit a parse tree produced by the {@code declVariableArray} * Visit a parse tree produced by {@link KickCParser#declType}.
* labeled alternative in {@link KickCParser#declVariable}.
* @param ctx the parse tree * @param ctx the parse tree
* @return the visitor result * @return the visitor result
*/ */
T visitDeclVariableArray(KickCParser.DeclVariableArrayContext ctx); T visitDeclType(KickCParser.DeclTypeContext ctx);
/** /**
* Visit a parse tree produced by the {@code declVariableName} * Visit a parse tree produced by {@link KickCParser#declPointer}.
* labeled alternative in {@link KickCParser#declVariable}.
* @param ctx the parse tree * @param ctx the parse tree
* @return the visitor result * @return the visitor result
*/ */
T visitDeclVariableName(KickCParser.DeclVariableNameContext ctx); T visitDeclPointer(KickCParser.DeclPointerContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#declArray}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeclArray(KickCParser.DeclArrayContext ctx);
/**
* Visit a parse tree produced by the {@code typeSpecifierSimple}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx);
/**
* Visit a parse tree produced by the {@code typeSpecifierPointer}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx);
/**
* Visit a parse tree produced by the {@code typeSpecifierArray}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx);
/**
* Visit a parse tree produced by the {@code typePar}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypePar(KickCParser.TypeParContext ctx);
/**
* Visit a parse tree produced by the {@code typeProcedure}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeProcedure(KickCParser.TypeProcedureContext ctx);
/**
* Visit a parse tree produced by the {@code typeArray}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeArray(KickCParser.TypeArrayContext ctx);
/**
* Visit a parse tree produced by the {@code typeStructRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeStructRef(KickCParser.TypeStructRefContext ctx);
/**
* Visit a parse tree produced by the {@code typeSimple}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSimple(KickCParser.TypeSimpleContext ctx);
/**
* Visit a parse tree produced by the {@code typeStructDef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeStructDef(KickCParser.TypeStructDefContext ctx);
/**
* Visit a parse tree produced by the {@code typeNamedRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeNamedRef(KickCParser.TypeNamedRefContext ctx);
/**
* Visit a parse tree produced by the {@code typeSignedSimple}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx);
/**
* Visit a parse tree produced by the {@code typeEnumRef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeEnumRef(KickCParser.TypeEnumRefContext ctx);
/**
* Visit a parse tree produced by the {@code typeEnumDef}
* labeled alternative in {@link KickCParser#type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeEnumDef(KickCParser.TypeEnumDefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#structRef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStructRef(KickCParser.StructRefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#structDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStructDef(KickCParser.StructDefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#structMembers}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStructMembers(KickCParser.StructMembersContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#enumRef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEnumRef(KickCParser.EnumRefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#enumDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEnumDef(KickCParser.EnumDefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#enumMemberList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEnumMemberList(KickCParser.EnumMemberListContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#enumMember}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEnumMember(KickCParser.EnumMemberContext ctx);
/** /**
* Visit a parse tree produced by {@link KickCParser#declFunction}. * Visit a parse tree produced by {@link KickCParser#declFunction}.
* @param ctx the parse tree * @param ctx the parse tree
@ -451,139 +576,6 @@ public interface KickCParserVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result * @return the visitor result
*/ */
T visitForClassicInitExpr(KickCParser.ForClassicInitExprContext ctx); T visitForClassicInitExpr(KickCParser.ForClassicInitExprContext ctx);
/**
* Visit a parse tree produced by the {@code typePar}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypePar(KickCParser.TypeParContext ctx);
/**
* Visit a parse tree produced by the {@code typeProcedure}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeProcedure(KickCParser.TypeProcedureContext 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 typeStructRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeStructRef(KickCParser.TypeStructRefContext 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 typeStructDef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeStructDef(KickCParser.TypeStructDefContext ctx);
/**
* Visit a parse tree produced by the {@code typeNamedRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeNamedRef(KickCParser.TypeNamedRefContext ctx);
/**
* Visit a parse tree produced by the {@code typeSignedSimple}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSignedSimple(KickCParser.TypeSignedSimpleContext ctx);
/**
* Visit a parse tree produced by the {@code typeEnumRef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeEnumRef(KickCParser.TypeEnumRefContext ctx);
/**
* Visit a parse tree produced by the {@code typeEnumDef}
* labeled alternative in {@link KickCParser#typeDecl}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeEnumDef(KickCParser.TypeEnumDefContext ctx);
/**
* Visit a parse tree produced by the {@code typeSpecifierSimple}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx);
/**
* Visit a parse tree produced by the {@code typeSpecifierPointer}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSpecifierPointer(KickCParser.TypeSpecifierPointerContext ctx);
/**
* Visit a parse tree produced by the {@code typeSpecifierArray}
* labeled alternative in {@link KickCParser#typeSpecifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTypeSpecifierArray(KickCParser.TypeSpecifierArrayContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#structRef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStructRef(KickCParser.StructRefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#structDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStructDef(KickCParser.StructDefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#structMembers}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStructMembers(KickCParser.StructMembersContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#enumRef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEnumRef(KickCParser.EnumRefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#enumDef}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEnumDef(KickCParser.EnumDefContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#enumMemberList}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEnumMemberList(KickCParser.EnumMemberListContext ctx);
/**
* Visit a parse tree produced by {@link KickCParser#enumMember}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEnumMember(KickCParser.EnumMemberContext ctx);
/** /**
* Visit a parse tree produced by the {@code commaNone} * Visit a parse tree produced by the {@code commaNone}
* labeled alternative in {@link KickCParser#commaExpr}. * labeled alternative in {@link KickCParser#commaExpr}.

View File

@ -207,7 +207,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override @Override
public Object visitDeclFunction(KickCParser.DeclFunctionContext ctx) { public Object visitDeclFunction(KickCParser.DeclFunctionContext ctx) {
this.visit(ctx.declTypes()); this.visit(ctx.declType());
for(KickCParser.DeclPointerContext declPointerContext : ctx.declPointer()) { for(KickCParser.DeclPointerContext declPointerContext : ctx.declPointer()) {
this.visit(declPointerContext); this.visit(declPointerContext);
} }
@ -277,7 +277,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override @Override
public Object visitParameterDeclType(KickCParser.ParameterDeclTypeContext ctx) { public Object visitParameterDeclType(KickCParser.ParameterDeclTypeContext ctx) {
this.visit(ctx.declTypes()); this.visit(ctx.declType());
for(KickCParser.DeclPointerContext declPointerContext : ctx.declPointer()) { for(KickCParser.DeclPointerContext declPointerContext : ctx.declPointer()) {
this.visit(declPointerContext); this.visit(declPointerContext);
} }
@ -637,6 +637,20 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
return null; return null;
} }
@Override
public Object visitDeclArray(KickCParser.DeclArrayContext ctx) {
// Handle array type declaration by updating the declared type and the array spec
SymbolType elementType = varDecl.getEffectiveType();
if(ctx.expr() != null) {
RValue sizeVal = (RValue) visit(ctx.expr());
varDecl.setVarArraySpec(new ArraySpec((ConstantValue) sizeVal));
varDecl.setVarType(new SymbolTypePointer(elementType));
} else {
varDecl.setVarArraySpec(new ArraySpec());
varDecl.setVarType(new SymbolTypePointer(elementType));
}
return null;
}
/** /**
* Visit the type/directive part of a declaration. Setup the local decl-variables * Visit the type/directive part of a declaration. Setup the local decl-variables
@ -645,10 +659,10 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
* @return null * @return null
*/ */
@Override @Override
public Object visitDeclTypes(KickCParser.DeclTypesContext ctx) { public Object visitDeclType(KickCParser.DeclTypeContext ctx) {
List<KickCParser.DirectiveContext> directive = ctx.directive(); List<KickCParser.DirectiveContext> directive = ctx.directive();
varDecl.exitType(); varDecl.exitType();
varDecl.setType((SymbolType) visit(ctx.typeDecl())); varDecl.setType((SymbolType) visit(ctx.type()));
varDecl.setDirectives(getDirectives(directive)); varDecl.setDirectives(getDirectives(directive));
varDecl.setComments(getCommentsSymbol(ctx.getParent())); varDecl.setComments(getCommentsSymbol(ctx.getParent()));
return null; return null;
@ -656,7 +670,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override @Override
public Object visitDeclVariables(KickCParser.DeclVariablesContext ctx) { public Object visitDeclVariables(KickCParser.DeclVariablesContext ctx) {
this.visit(ctx.declTypes()); this.visit(ctx.declType());
this.visit(ctx.declVariableList()); this.visit(ctx.declVariableList());
varDecl.exitType(); varDecl.exitType();
return null; return null;
@ -677,7 +691,10 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override @Override
public Object visitDeclVariableInitExpr(KickCParser.DeclVariableInitExprContext ctx) { public Object visitDeclVariableInitExpr(KickCParser.DeclVariableInitExprContext ctx) {
String varName = (String) this.visit(ctx.declVariable()); for(KickCParser.DeclArrayContext declArrayContext : ctx.declArray()) {
this.visit(declArrayContext);
}
String varName = ctx.NAME().getText();
KickCParser.ExprContext initializer = ctx.expr(); KickCParser.ExprContext initializer = ctx.expr();
StatementSource statementSource = new StatementSource(ctx); StatementSource statementSource = new StatementSource(ctx);
StatementSource declSource = new StatementSource((ParserRuleContext) ctx.parent.parent); StatementSource declSource = new StatementSource((ParserRuleContext) ctx.parent.parent);
@ -710,27 +727,6 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
return null; return null;
} }
@Override
public String visitDeclVariableName(KickCParser.DeclVariableNameContext ctx) {
return ctx.NAME().getText();
}
@Override
public String visitDeclVariableArray(KickCParser.DeclVariableArrayContext ctx) {
// Handle array type declaration by updating the declared type and the array spec
SymbolType elementType = varDecl.getEffectiveType();
if(ctx.expr() != null) {
RValue sizeVal = (RValue) visit(ctx.expr());
varDecl.setVarArraySpec(new ArraySpec((ConstantValue) sizeVal));
varDecl.setVarType(new SymbolTypePointer(elementType));
} else {
varDecl.setVarArraySpec(new ArraySpec());
varDecl.setVarType(new SymbolTypePointer(elementType));
}
// Find the variable name
return (String) this.visit(ctx.declVariable());
}
/** /**
* Ensure that the initializer value is a constant. Fail if it is not * Ensure that the initializer value is a constant. Fail if it is not
* *
@ -753,7 +749,10 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override @Override
public Object visitDeclVariableInitKasm(KickCParser.DeclVariableInitKasmContext ctx) { public Object visitDeclVariableInitKasm(KickCParser.DeclVariableInitKasmContext ctx) {
String varName = (String) this.visit(ctx.declVariable()); for(KickCParser.DeclArrayContext declArrayContext : ctx.declArray()) {
this.visit(declArrayContext);
}
String varName = ctx.NAME().getText();
StatementSource statementSource = new StatementSource(ctx); StatementSource statementSource = new StatementSource(ctx);
if(!(this.varDecl.getEffectiveType() instanceof SymbolTypePointer) || varDecl.getEffectiveArraySpec() == null) { if(!(this.varDecl.getEffectiveType() instanceof SymbolTypePointer) || varDecl.getEffectiveArraySpec() == null) {
throw new CompileError("KickAsm initializers only supported for arrays " + varDecl.getEffectiveType().getTypeName(), statementSource); throw new CompileError("KickAsm initializers only supported for arrays " + varDecl.getEffectiveType().getTypeName(), statementSource);
@ -1270,8 +1269,8 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
loopStack.push(new Loop(blockScope, false)); loopStack.push(new Loop(blockScope, false));
StatementSource statementSource = StatementSource.forRanged(ctx); StatementSource statementSource = StatementSource.forRanged(ctx);
// Create / find declared loop variable // Create / find declared loop variable
if(ctx.declTypes() != null) { if(ctx.declType() != null) {
this.visit(ctx.declTypes()); this.visit(ctx.declType());
for(KickCParser.DeclPointerContext declPointerContext : ctx.declPointer()) { for(KickCParser.DeclPointerContext declPointerContext : ctx.declPointer()) {
this.visit(declPointerContext); this.visit(declPointerContext);
} }
@ -1641,6 +1640,9 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
Scope typeDefScope = program.getScope().getTypeDefScope(); Scope typeDefScope = program.getScope().getTypeDefScope();
Variable typeDefVariable = typeDefScope.getVariable(ctx.getText()); Variable typeDefVariable = typeDefScope.getVariable(ctx.getText());
if(typeDefVariable != null) { if(typeDefVariable != null) {
if(typeDefVariable.getArraySpec()!=null)
// TODO: Handle typedef array of array correctly
varDecl.setArraySpec(typeDefVariable.getArraySpec());
return typeDefVariable.getType(); return typeDefVariable.getType();
} }
throw new CompileError("Unknown type " + ctx.getText(), new StatementSource(ctx)); throw new CompileError("Unknown type " + ctx.getText(), new StatementSource(ctx));
@ -1666,14 +1668,14 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override @Override
public SymbolType visitTypePar(KickCParser.TypeParContext ctx) { public SymbolType visitTypePar(KickCParser.TypeParContext ctx) {
return (SymbolType) visit(ctx.typeDecl()); return (SymbolType) visit(ctx.type());
} }
@Override @Override
public SymbolType visitTypeArray(KickCParser.TypeArrayContext ctx) { public SymbolType visitTypeArray(KickCParser.TypeArrayContext ctx) {
if(program.isWarnArrayType()) { if(program.isWarnArrayType()) {
program.getLog().append("Non-standard array declaration.\n" + new StatementSource(ctx).toString()); program.getLog().append("Non-standard array declaration.\n" + new StatementSource(ctx).toString());
SymbolType elementType = (SymbolType) visit(ctx.typeDecl()); SymbolType elementType = (SymbolType) visit(ctx.type());
if(ctx.expr() != null) { if(ctx.expr() != null) {
RValue sizeVal = (RValue) visit(ctx.expr()); RValue sizeVal = (RValue) visit(ctx.expr());
varDecl.setArraySpec(new ArraySpec((ConstantValue) sizeVal)); varDecl.setArraySpec(new ArraySpec((ConstantValue) sizeVal));
@ -1689,7 +1691,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override @Override
public Object visitTypeProcedure(KickCParser.TypeProcedureContext ctx) { public Object visitTypeProcedure(KickCParser.TypeProcedureContext ctx) {
SymbolType returnType = (SymbolType) visit(ctx.typeDecl()); SymbolType returnType = (SymbolType) visit(ctx.type());
return new SymbolTypeProcedure(returnType); return new SymbolTypeProcedure(returnType);
} }
@ -1697,12 +1699,17 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
public Object visitTypeDef(KickCParser.TypeDefContext ctx) { public Object visitTypeDef(KickCParser.TypeDefContext ctx) {
Scope typedefScope = program.getScope().getTypeDefScope(); Scope typedefScope = program.getScope().getTypeDefScope();
scopeStack.push(typedefScope); scopeStack.push(typedefScope);
this.visit(ctx.declTypes()); this.visit(ctx.declType());
for(KickCParser.DeclPointerContext declPointerContext : ctx.declPointer()) { for(KickCParser.DeclPointerContext declPointerContext : ctx.declPointer()) {
this.visit(declPointerContext); this.visit(declPointerContext);
} }
for(KickCParser.DeclArrayContext declArrayContext : ctx.declArray()) {
this.visit(declArrayContext);
}
String typedefName = ctx.NAME().getText(); String typedefName = ctx.NAME().getText();
typedefScope.add(Variable.createPhiMaster(typedefName, varDecl.getEffectiveType(), typedefScope, defaultMemoryArea, currentDataSegment)); final Variable typeDefVar = Variable.createPhiMaster(typedefName, varDecl.getEffectiveType(), typedefScope, defaultMemoryArea, currentDataSegment);
typeDefVar.setArraySpec(varDecl.getEffectiveArraySpec());
typedefScope.add(typeDefVar);
scopeStack.pop(); scopeStack.pop();
varDecl.exitType(); varDecl.exitType();
return null; return null;
@ -1858,7 +1865,7 @@ public class Pass0GenerateStatementSequence extends KickCParserBaseVisitor<Objec
@Override @Override
public SymbolType visitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx) { public SymbolType visitTypeSpecifierSimple(KickCParser.TypeSpecifierSimpleContext ctx) {
return (SymbolType) this.visit(ctx.typeDecl()); return (SymbolType) this.visit(ctx.type());
} }
@Override @Override

View File

@ -942,6 +942,11 @@ public class TestPrograms {
compileAndCompare("enum-0"); compileAndCompare("enum-0");
} }
@Test
public void testTypedef3() throws IOException, URISyntaxException {
compileAndCompare("typedef-3");
}
@Test @Test
public void testTypedef2() throws IOException, URISyntaxException { public void testTypedef2() throws IOException, URISyntaxException {
compileAndCompare("typedef-2"); compileAndCompare("typedef-2");

12
src/test/kc/typedef-3.kc Normal file
View File

@ -0,0 +1,12 @@
// Typedef an array
const char* SCREEN = 0x0400;
typedef char STR[7];
STR a = "cml";
void main() {
for(char i:0..6)
SCREEN[i] = a[i];
}

View File

@ -0,0 +1,21 @@
// Typedef an array
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label SCREEN = $400
main: {
ldx #0
__b1:
// SCREEN[i] = a[i]
lda a,x
sta SCREEN,x
// for(char i:0..6)
inx
cpx #7
bne __b1
// }
rts
}
a: .text "cml"
.byte 0
.fill 3, 0

View File

@ -0,0 +1,23 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
(void()) main()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
[6] *((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) a + (byte) main::i#2)
[7] (byte) main::i#1 ← ++ (byte) main::i#2
[8] if((byte) main::i#1!=(byte) 7) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
[9] return
to:@return

337
src/test/ref/typedef-3.log Normal file
View File

@ -0,0 +1,337 @@
Culled Empty Block (label) main::@2
CONTROL FLOW GRAPH SSA
@begin: scope:[] from
to:@1
(void()) main()
main: scope:[main] from @1
(byte) main::i#0 ← (byte) 0
to:main::@1
main::@1: scope:[main] from main main::@1
(byte) main::i#2 ← phi( main/(byte) main::i#0 main::@1/(byte) main::i#1 )
*((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) a + (byte) main::i#2)
(byte) main::i#1 ← (byte) main::i#2 + rangenext(0,6)
(bool~) main::$0 ← (byte) main::i#1 != rangelast(0,6)
if((bool~) main::$0) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
return
to:@return
@1: scope:[] from @begin
call main
to:@2
@2: scope:[] from @1
to:@end
@end: scope:[] from @2
SYMBOL TABLE SSA
(label) @1
(label) @2
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*)(number) $400
(const byte*) a[(number) 7] = (byte*) "cml"
(void()) main()
(bool~) main::$0
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#0
(byte) main::i#1
(byte) main::i#2
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification
Simple Condition (bool~) main::$0 [5] if((byte) main::i#1!=rangelast(0,6)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant (const byte) main::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [3] main::i#1 ← ++ main::i#2 to ++
Resolved ranged comparison value [5] if(main::i#1!=rangelast(0,6)) goto main::@1 to (number) 7
Adding number conversion cast (unumber) 7 in if((byte) main::i#1!=(number) 7) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 7
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (byte) 7
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inlining constant with var siblings (const byte) main::i#0
Constant inlined main::i#0 = (byte) 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@3(between main::@1 and main::@1)
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @2
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
CALL GRAPH
Calls in [] to main:2
Created 1 initial phi equivalence classes
Coalesced [11] main::i#3 ← main::i#1
Coalesced down to 1 phi equivalence classes
Culled Empty Block (label) @2
Culled Empty Block (label) main::@3
Adding NOP phi() at start of @begin
Adding NOP phi() at start of @1
Adding NOP phi() at start of @end
Adding NOP phi() at start of main
FINAL CONTROL FLOW GRAPH
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
(void()) main()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@1
[5] (byte) main::i#2 ← phi( main/(byte) 0 main::@1/(byte) main::i#1 )
[6] *((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) a + (byte) main::i#2)
[7] (byte) main::i#1 ← ++ (byte) main::i#2
[8] if((byte) main::i#1!=(byte) 7) goto main::@1
to:main::@return
main::@return: scope:[main] from main::@1
[9] return
to:@return
VARIABLE REGISTER WEIGHTS
(void()) main()
(byte) main::i
(byte) main::i#1 151.5
(byte) main::i#2 202.0
Initial phi equivalence classes
[ main::i#2 main::i#1 ]
Complete equivalence classes
[ main::i#2 main::i#1 ]
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
INITIAL ASM
Target platform is c64basic / MOS6502X
// File Comments
// Typedef an array
// Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
main_from___b1:
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
main: {
.label i = 2
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1
lda #0
sta.z i
jmp __b1
// [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
__b1_from___b1:
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] *((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) a + (byte) main::i#2) -- pbuc1_derefidx_vbuz1=pbuc2_derefidx_vbuz1
ldy.z i
lda a,y
sta SCREEN,y
// [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuz1=_inc_vbuz1
inc.z i
// [8] if((byte) main::i#1!=(byte) 7) goto main::@1 -- vbuz1_neq_vbuc1_then_la1
lda #7
cmp.z i
bne __b1_from___b1
jmp __breturn
// main::@return
__breturn:
// [9] return
rts
}
// File Data
a: .text "cml"
.byte 0
.fill 3, 0
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [6] *((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) a + (byte) main::i#2) [ main::i#2 ] ( main:2 [ main::i#2 ] { } ) always clobbers reg byte a
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
Statement [6] *((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) a + (byte) main::i#2) [ main::i#2 ] ( main:2 [ main::i#2 ] { } ) always clobbers reg byte a
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x , reg byte y ,
REGISTER UPLIFT SCOPES
Uplift Scope [main] 353.5: zp[1]:2 [ main::i#2 main::i#1 ]
Uplift Scope []
Uplifting [main] best 288 combination reg byte x [ main::i#2 main::i#1 ]
Uplifting [] best 288 combination
ASSEMBLER BEFORE OPTIMIZATION
// File Comments
// Typedef an array
// Upstart
.pc = $801 "Basic"
:BasicUpstart(__bbegin)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
// @begin
__bbegin:
// [1] phi from @begin to @1 [phi:@begin->@1]
__b1_from___bbegin:
jmp __b1
// @1
__b1:
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
main_from___b1:
jsr main
// [3] phi from @1 to @end [phi:@1->@end]
__bend_from___b1:
jmp __bend
// @end
__bend:
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
__b1_from_main:
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
jmp __b1
// [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
__b1_from___b1:
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
jmp __b1
// main::@1
__b1:
// [6] *((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) a + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda a,x
sta SCREEN,x
// [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [8] if((byte) main::i#1!=(byte) 7) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #7
bne __b1_from___b1
jmp __breturn
// main::@return
__breturn:
// [9] return
rts
}
// File Data
a: .text "cml"
.byte 0
.fill 3, 0
ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __bend
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b1 with __b1
Removing instruction __b1_from___bbegin:
Removing instruction __b1:
Removing instruction main_from___b1:
Removing instruction __bend_from___b1:
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __bend:
Removing instruction __b1_from_main:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Updating BasicUpstart to call main directly
Removing instruction jsr main
Succesful ASM optimization Pass5SkipBegin
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction __bbegin:
Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE
(label) @1
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(const byte*) a[(number) 7] = (byte*) "cml"
(void()) main()
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 151.5
(byte) main::i#2 reg byte x 202.0
reg byte x [ main::i#2 main::i#1 ]
FINAL ASSEMBLER
Score: 186
// File Comments
// Typedef an array
// Upstart
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
// Global Constants & labels
.label SCREEN = $400
// @begin
// [1] phi from @begin to @1 [phi:@begin->@1]
// @1
// [2] call main
// [4] phi from @1 to main [phi:@1->main]
// [3] phi from @1 to @end [phi:@1->@end]
// @end
// main
main: {
// [5] phi from main to main::@1 [phi:main->main::@1]
// [5] phi (byte) main::i#2 = (byte) 0 [phi:main->main::@1#0] -- vbuxx=vbuc1
ldx #0
// [5] phi from main::@1 to main::@1 [phi:main::@1->main::@1]
// [5] phi (byte) main::i#2 = (byte) main::i#1 [phi:main::@1->main::@1#0] -- register_copy
// main::@1
__b1:
// SCREEN[i] = a[i]
// [6] *((const byte*) SCREEN + (byte) main::i#2) ← *((const byte*) a + (byte) main::i#2) -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx
lda a,x
sta SCREEN,x
// for(char i:0..6)
// [7] (byte) main::i#1 ← ++ (byte) main::i#2 -- vbuxx=_inc_vbuxx
inx
// [8] if((byte) main::i#1!=(byte) 7) goto main::@1 -- vbuxx_neq_vbuc1_then_la1
cpx #7
bne __b1
// main::@return
// }
// [9] return
rts
}
// File Data
a: .text "cml"
.byte 0
.fill 3, 0

View File

@ -0,0 +1,13 @@
(label) @1
(label) @begin
(label) @end
(const byte*) SCREEN = (byte*) 1024
(const byte*) a[(number) 7] = (byte*) "cml"
(void()) main()
(label) main::@1
(label) main::@return
(byte) main::i
(byte) main::i#1 reg byte x 151.5
(byte) main::i#2 reg byte x 202.0
reg byte x [ main::i#2 main::i#1 ]