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/CGrammarVisitor.cs | 230 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 208 insertions(+), 22 deletions(-) (limited to 'Compiler/gen/CGrammarVisitor.cs') diff --git a/Compiler/gen/CGrammarVisitor.cs b/Compiler/gen/CGrammarVisitor.cs index 1f9691a..50cb551 100644 --- a/Compiler/gen/CGrammarVisitor.cs +++ b/Compiler/gen/CGrammarVisitor.cs @@ -44,6 +44,24 @@ public interface ICGrammarVisitor : IParseTreeVisitor { /// The visitor result. Result VisitFunction([NotNull] CGrammarParser.FunctionContext context); /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitBody([NotNull] CGrammarParser.BodyContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitBlock([NotNull] CGrammarParser.BlockContext context); + /// + /// Visit a parse tree produced by . + /// + /// The parse tree. + /// The visitor result. + Result VisitBlock_item([NotNull] CGrammarParser.Block_itemContext context); + /// /// Visit a parse tree produced by the returnStatement /// labeled alternative in . /// @@ -51,26 +69,33 @@ public interface ICGrammarVisitor : IParseTreeVisitor { /// The visitor result. Result VisitReturnStatement([NotNull] CGrammarParser.ReturnStatementContext context); /// - /// Visit a parse tree produced by the bitwiseXorExpression - /// labeled alternative in . + /// Visit a parse tree produced by the ifStatement + /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitBitwiseXorExpression([NotNull] CGrammarParser.BitwiseXorExpressionContext context); + Result VisitIfStatement([NotNull] CGrammarParser.IfStatementContext context); /// - /// Visit a parse tree produced by the constantExpression - /// labeled alternative in . + /// Visit a parse tree produced by the expressionStatement + /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitConstantExpression([NotNull] CGrammarParser.ConstantExpressionContext context); + Result VisitExpressionStatement([NotNull] CGrammarParser.ExpressionStatementContext context); /// - /// Visit a parse tree produced by the lessThanOrEqualExpression + /// Visit a parse tree produced by the variableDeclaration + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitVariableDeclaration([NotNull] CGrammarParser.VariableDeclarationContext context); + /// + /// Visit a parse tree produced by the compoundSubtractExpression /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitLessThanOrEqualExpression([NotNull] CGrammarParser.LessThanOrEqualExpressionContext context); + Result VisitCompoundSubtractExpression([NotNull] CGrammarParser.CompoundSubtractExpressionContext context); /// /// Visit a parse tree produced by the modulusExpression /// labeled alternative in . @@ -86,12 +111,12 @@ public interface ICGrammarVisitor : IParseTreeVisitor { /// The visitor result. Result VisitNotExpression([NotNull] CGrammarParser.NotExpressionContext context); /// - /// Visit a parse tree produced by the notEqualExpression + /// Visit a parse tree produced by the decrementPrefixExpression /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitNotEqualExpression([NotNull] CGrammarParser.NotEqualExpressionContext context); + Result VisitDecrementPrefixExpression([NotNull] CGrammarParser.DecrementPrefixExpressionContext context); /// /// Visit a parse tree produced by the multiplyExpression /// labeled alternative in . @@ -107,33 +132,33 @@ public interface ICGrammarVisitor : IParseTreeVisitor { /// The visitor result. Result VisitGreaterThanExpression([NotNull] CGrammarParser.GreaterThanExpressionContext context); /// - /// Visit a parse tree produced by the logicalOrExpression + /// Visit a parse tree produced by the bitwiseLeftShiftExpression /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitLogicalOrExpression([NotNull] CGrammarParser.LogicalOrExpressionContext context); + Result VisitBitwiseLeftShiftExpression([NotNull] CGrammarParser.BitwiseLeftShiftExpressionContext context); /// - /// Visit a parse tree produced by the greaterThanOrEqualExpression + /// Visit a parse tree produced by the bitwiseRightShiftExpression /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitGreaterThanOrEqualExpression([NotNull] CGrammarParser.GreaterThanOrEqualExpressionContext context); + Result VisitBitwiseRightShiftExpression([NotNull] CGrammarParser.BitwiseRightShiftExpressionContext context); /// - /// Visit a parse tree produced by the divideExpression + /// Visit a parse tree produced by the variableExpression /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitDivideExpression([NotNull] CGrammarParser.DivideExpressionContext context); + Result VisitVariableExpression([NotNull] CGrammarParser.VariableExpressionContext context); /// - /// Visit a parse tree produced by the bitwiseOrExpression + /// Visit a parse tree produced by the compoundDivideExpression /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitBitwiseOrExpression([NotNull] CGrammarParser.BitwiseOrExpressionContext context); + Result VisitCompoundDivideExpression([NotNull] CGrammarParser.CompoundDivideExpressionContext context); /// /// Visit a parse tree produced by the parenthesizedExpression /// labeled alternative in . @@ -142,19 +167,26 @@ public interface ICGrammarVisitor : IParseTreeVisitor { /// The visitor result. Result VisitParenthesizedExpression([NotNull] CGrammarParser.ParenthesizedExpressionContext context); /// - /// Visit a parse tree produced by the addExpression + /// Visit a parse tree produced by the compoundAddExpression /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitAddExpression([NotNull] CGrammarParser.AddExpressionContext context); + Result VisitCompoundAddExpression([NotNull] CGrammarParser.CompoundAddExpressionContext context); /// - /// Visit a parse tree produced by the subtractExpression + /// Visit a parse tree produced by the compoundMultiplyExpression /// labeled alternative in . /// /// The parse tree. /// The visitor result. - Result VisitSubtractExpression([NotNull] CGrammarParser.SubtractExpressionContext context); + Result VisitCompoundMultiplyExpression([NotNull] CGrammarParser.CompoundMultiplyExpressionContext context); + /// + /// Visit a parse tree produced by the compoundBitwiseXorExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitCompoundBitwiseXorExpression([NotNull] CGrammarParser.CompoundBitwiseXorExpressionContext context); /// /// Visit a parse tree produced by the bitwiseAndExpression /// labeled alternative in . @@ -191,10 +223,164 @@ public interface ICGrammarVisitor : IParseTreeVisitor { /// The visitor result. Result VisitEqualExpression([NotNull] CGrammarParser.EqualExpressionContext context); /// + /// Visit a parse tree produced by the bitwiseXorExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitBitwiseXorExpression([NotNull] CGrammarParser.BitwiseXorExpressionContext context); + /// + /// Visit a parse tree produced by the constantExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitConstantExpression([NotNull] CGrammarParser.ConstantExpressionContext context); + /// + /// Visit a parse tree produced by the compoundModulusExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitCompoundModulusExpression([NotNull] CGrammarParser.CompoundModulusExpressionContext context); + /// + /// Visit a parse tree produced by the lessThanOrEqualExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitLessThanOrEqualExpression([NotNull] CGrammarParser.LessThanOrEqualExpressionContext context); + /// + /// Visit a parse tree produced by the incrementPostfixExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitIncrementPostfixExpression([NotNull] CGrammarParser.IncrementPostfixExpressionContext context); + /// + /// Visit a parse tree produced by the compoundBitwiseRightShiftExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitCompoundBitwiseRightShiftExpression([NotNull] CGrammarParser.CompoundBitwiseRightShiftExpressionContext context); + /// + /// Visit a parse tree produced by the assignmentExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitAssignmentExpression([NotNull] CGrammarParser.AssignmentExpressionContext context); + /// + /// Visit a parse tree produced by the notEqualExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitNotEqualExpression([NotNull] CGrammarParser.NotEqualExpressionContext context); + /// + /// Visit a parse tree produced by the compoundBitwiseAndExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitCompoundBitwiseAndExpression([NotNull] CGrammarParser.CompoundBitwiseAndExpressionContext context); + /// + /// Visit a parse tree produced by the logicalOrExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitLogicalOrExpression([NotNull] CGrammarParser.LogicalOrExpressionContext context); + /// + /// Visit a parse tree produced by the commaExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitCommaExpression([NotNull] CGrammarParser.CommaExpressionContext context); + /// + /// Visit a parse tree produced by the incrementPrefixExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitIncrementPrefixExpression([NotNull] CGrammarParser.IncrementPrefixExpressionContext context); + /// + /// Visit a parse tree produced by the greaterThanOrEqualExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitGreaterThanOrEqualExpression([NotNull] CGrammarParser.GreaterThanOrEqualExpressionContext context); + /// + /// Visit a parse tree produced by the divideExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitDivideExpression([NotNull] CGrammarParser.DivideExpressionContext context); + /// + /// Visit a parse tree produced by the bitwiseOrExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitBitwiseOrExpression([NotNull] CGrammarParser.BitwiseOrExpressionContext context); + /// + /// Visit a parse tree produced by the addExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitAddExpression([NotNull] CGrammarParser.AddExpressionContext context); + /// + /// Visit a parse tree produced by the subtractExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitSubtractExpression([NotNull] CGrammarParser.SubtractExpressionContext context); + /// + /// Visit a parse tree produced by the compoundBitwiseOrExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitCompoundBitwiseOrExpression([NotNull] CGrammarParser.CompoundBitwiseOrExpressionContext context); + /// + /// Visit a parse tree produced by the decrementPostfixExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitDecrementPostfixExpression([NotNull] CGrammarParser.DecrementPostfixExpressionContext context); + /// + /// Visit a parse tree produced by the ternaryExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitTernaryExpression([NotNull] CGrammarParser.TernaryExpressionContext context); + /// + /// Visit a parse tree produced by the compoundBitwiseLeftShiftExpression + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitCompoundBitwiseLeftShiftExpression([NotNull] CGrammarParser.CompoundBitwiseLeftShiftExpressionContext context); + /// /// Visit a parse tree produced by the intConstant /// labeled alternative in . /// /// The parse tree. /// The visitor result. Result VisitIntConstant([NotNull] CGrammarParser.IntConstantContext context); + /// + /// Visit a parse tree produced by the variableTarget + /// labeled alternative in . + /// + /// The parse tree. + /// The visitor result. + Result VisitVariableTarget([NotNull] CGrammarParser.VariableTargetContext context); } -- cgit v1.3.1