From e62b66dd08ca445d1f7e5b802a503ad3ec83b2df Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Fri, 8 Aug 2025 23:57:26 +1000 Subject: added branching to compiler and comment generation --- Compiler/gen/CGrammarBaseVisitor.cs | 338 +++++++++++++++++++++++++++++++++--- 1 file changed, 316 insertions(+), 22 deletions(-) (limited to 'Compiler/gen/CGrammarBaseVisitor.cs') diff --git a/Compiler/gen/CGrammarBaseVisitor.cs b/Compiler/gen/CGrammarBaseVisitor.cs index 1f864c3..704cdd1 100644 --- a/Compiler/gen/CGrammarBaseVisitor.cs +++ b/Compiler/gen/CGrammarBaseVisitor.cs @@ -55,6 +55,36 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitFunction([NotNull] CGrammarParser.FunctionContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitBody([NotNull] CGrammarParser.BodyContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitBlock([NotNull] CGrammarParser.BlockContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitBlock_item([NotNull] CGrammarParser.Block_itemContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by the returnStatement /// labeled alternative in . /// @@ -66,8 +96,8 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitReturnStatement([NotNull] CGrammarParser.ReturnStatementContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the bitwiseXorExpression - /// labeled alternative in . + /// Visit a parse tree produced by the ifStatement + /// labeled alternative in . /// /// The default implementation returns the result of calling /// on . @@ -75,10 +105,10 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitBitwiseXorExpression([NotNull] CGrammarParser.BitwiseXorExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitIfStatement([NotNull] CGrammarParser.IfStatementContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the constantExpression - /// labeled alternative in . + /// Visit a parse tree produced by the expressionStatement + /// labeled alternative in . /// /// The default implementation returns the result of calling /// on . @@ -86,9 +116,20 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitConstantExpression([NotNull] CGrammarParser.ConstantExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitExpressionStatement([NotNull] CGrammarParser.ExpressionStatementContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the lessThanOrEqualExpression + /// Visit a parse tree produced by the variableDeclaration + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitVariableDeclaration([NotNull] CGrammarParser.VariableDeclarationContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the compoundSubtractExpression /// labeled alternative in . /// /// The default implementation returns the result of calling @@ -97,7 +138,7 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitLessThanOrEqualExpression([NotNull] CGrammarParser.LessThanOrEqualExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitCompoundSubtractExpression([NotNull] CGrammarParser.CompoundSubtractExpressionContext context) { return VisitChildren(context); } /// /// Visit a parse tree produced by the modulusExpression /// labeled alternative in . @@ -121,7 +162,7 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitNotExpression([NotNull] CGrammarParser.NotExpressionContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the notEqualExpression + /// Visit a parse tree produced by the decrementPrefixExpression /// labeled alternative in . /// /// The default implementation returns the result of calling @@ -130,7 +171,7 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitNotEqualExpression([NotNull] CGrammarParser.NotEqualExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitDecrementPrefixExpression([NotNull] CGrammarParser.DecrementPrefixExpressionContext context) { return VisitChildren(context); } /// /// Visit a parse tree produced by the multiplyExpression /// labeled alternative in . @@ -154,7 +195,7 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitGreaterThanExpression([NotNull] CGrammarParser.GreaterThanExpressionContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the logicalOrExpression + /// Visit a parse tree produced by the bitwiseLeftShiftExpression /// labeled alternative in . /// /// The default implementation returns the result of calling @@ -163,9 +204,9 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitLogicalOrExpression([NotNull] CGrammarParser.LogicalOrExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitBitwiseLeftShiftExpression([NotNull] CGrammarParser.BitwiseLeftShiftExpressionContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the greaterThanOrEqualExpression + /// Visit a parse tree produced by the bitwiseRightShiftExpression /// labeled alternative in . /// /// The default implementation returns the result of calling @@ -174,9 +215,9 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitGreaterThanOrEqualExpression([NotNull] CGrammarParser.GreaterThanOrEqualExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitBitwiseRightShiftExpression([NotNull] CGrammarParser.BitwiseRightShiftExpressionContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the divideExpression + /// Visit a parse tree produced by the variableExpression /// labeled alternative in . /// /// The default implementation returns the result of calling @@ -185,9 +226,9 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitDivideExpression([NotNull] CGrammarParser.DivideExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitVariableExpression([NotNull] CGrammarParser.VariableExpressionContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the bitwiseOrExpression + /// Visit a parse tree produced by the compoundDivideExpression /// labeled alternative in . /// /// The default implementation returns the result of calling @@ -196,7 +237,7 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitBitwiseOrExpression([NotNull] CGrammarParser.BitwiseOrExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitCompoundDivideExpression([NotNull] CGrammarParser.CompoundDivideExpressionContext context) { return VisitChildren(context); } /// /// Visit a parse tree produced by the parenthesizedExpression /// labeled alternative in . @@ -209,7 +250,7 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitParenthesizedExpression([NotNull] CGrammarParser.ParenthesizedExpressionContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the addExpression + /// Visit a parse tree produced by the compoundAddExpression /// labeled alternative in . /// /// The default implementation returns the result of calling @@ -218,9 +259,9 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitAddExpression([NotNull] CGrammarParser.AddExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitCompoundAddExpression([NotNull] CGrammarParser.CompoundAddExpressionContext context) { return VisitChildren(context); } /// - /// Visit a parse tree produced by the subtractExpression + /// Visit a parse tree produced by the compoundMultiplyExpression /// labeled alternative in . /// /// The default implementation returns the result of calling @@ -229,7 +270,18 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitor /// The parse tree. /// The visitor result. - public virtual Result VisitSubtractExpression([NotNull] CGrammarParser.SubtractExpressionContext context) { return VisitChildren(context); } + public virtual Result VisitCompoundMultiplyExpression([NotNull] CGrammarParser.CompoundMultiplyExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the compoundBitwiseXorExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCompoundBitwiseXorExpression([NotNull] CGrammarParser.CompoundBitwiseXorExpressionContext context) { return VisitChildren(context); } /// /// Visit a parse tree produced by the bitwiseAndExpression /// labeled alternative in . @@ -286,6 +338,237 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitorThe visitor result. public virtual Result VisitEqualExpression([NotNull] CGrammarParser.EqualExpressionContext context) { return VisitChildren(context); } /// + /// Visit a parse tree produced by the bitwiseXorExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitBitwiseXorExpression([NotNull] CGrammarParser.BitwiseXorExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the constantExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitConstantExpression([NotNull] CGrammarParser.ConstantExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the compoundModulusExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCompoundModulusExpression([NotNull] CGrammarParser.CompoundModulusExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the lessThanOrEqualExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitLessThanOrEqualExpression([NotNull] CGrammarParser.LessThanOrEqualExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the incrementPostfixExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitIncrementPostfixExpression([NotNull] CGrammarParser.IncrementPostfixExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the compoundBitwiseRightShiftExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCompoundBitwiseRightShiftExpression([NotNull] CGrammarParser.CompoundBitwiseRightShiftExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the assignmentExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAssignmentExpression([NotNull] CGrammarParser.AssignmentExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the notEqualExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitNotEqualExpression([NotNull] CGrammarParser.NotEqualExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the compoundBitwiseAndExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCompoundBitwiseAndExpression([NotNull] CGrammarParser.CompoundBitwiseAndExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the logicalOrExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitLogicalOrExpression([NotNull] CGrammarParser.LogicalOrExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the commaExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCommaExpression([NotNull] CGrammarParser.CommaExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the incrementPrefixExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitIncrementPrefixExpression([NotNull] CGrammarParser.IncrementPrefixExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the greaterThanOrEqualExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitGreaterThanOrEqualExpression([NotNull] CGrammarParser.GreaterThanOrEqualExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the divideExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitDivideExpression([NotNull] CGrammarParser.DivideExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the bitwiseOrExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitBitwiseOrExpression([NotNull] CGrammarParser.BitwiseOrExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the addExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitAddExpression([NotNull] CGrammarParser.AddExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the subtractExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitSubtractExpression([NotNull] CGrammarParser.SubtractExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the compoundBitwiseOrExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCompoundBitwiseOrExpression([NotNull] CGrammarParser.CompoundBitwiseOrExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the decrementPostfixExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitDecrementPostfixExpression([NotNull] CGrammarParser.DecrementPostfixExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the ternaryExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitTernaryExpression([NotNull] CGrammarParser.TernaryExpressionContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the compoundBitwiseLeftShiftExpression + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitCompoundBitwiseLeftShiftExpression([NotNull] CGrammarParser.CompoundBitwiseLeftShiftExpressionContext context) { return VisitChildren(context); } + /// /// Visit a parse tree produced by the intConstant /// labeled alternative in . /// @@ -296,4 +579,15 @@ public partial class CGrammarBaseVisitor : AbstractParseTreeVisitorThe parse tree. /// The visitor result. public virtual Result VisitIntConstant([NotNull] CGrammarParser.IntConstantContext context) { return VisitChildren(context); } + /// + /// Visit a parse tree produced by the variableTarget + /// labeled alternative in . + /// + /// The default implementation returns the result of calling + /// on . + /// + /// + /// The parse tree. + /// The visitor result. + public virtual Result VisitVariableTarget([NotNull] CGrammarParser.VariableTargetContext context) { return VisitChildren(context); } } -- cgit v1.3.1