Skip to content

Commit 441db8e

Browse files
authored
DocComment Updates (#322)
1 parent 5d4cce8 commit 441db8e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+493
-46
lines changed

IgnoredWords.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Contributors
4949
crlf
5050
csharp
5151
csproj
52+
customizable
5253
de
5354
defacto
5455
dllimport

docfx/ReadMe.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
> have great memories or are otherwise easily confused. :nerd_face:)
66
77
DocFX is used to generate the documentation for this library. There is confusion on
8-
what the "statictoc" template means and requires. It is ***LITERALLY*** that the
9-
Table of Contents (TOC) is statically generated. So that the entire site is servable
10-
from file path. This ***DOES NOT*** mean that the default+modern template is
8+
what the "statictoc" template means and requires. It is ***LITERALLY*** that, the
9+
Table of Contents (TOC) is statically generated such that the entire site is servable
10+
from a file path. This ***DOES NOT*** mean that the default+modern template is
1111
unusable for hosted static site scenarios like 'gh-pages' in GitHub. It only means
1212
that the TOC support will ***require*** a hosted site to provide the contents needed
1313
by the generated TOC client side scripting. That's it. Don't fear the built-in
1414
templates (Despite the lack of decent docs explaining the details [Yeah, this
15-
project previously fell into those gaps and even constructed a custom template to
16-
deal with it... Sigh, what a waste of time... :facepalm: ])
15+
project previously fell into those gaps and even constructed a complete custom template
16+
to deal with it... Sigh, what a waste of time... :facepalm: ])
1717

1818
## Changes Over Time
1919
DocFX has obsoleted the `docfxconsole` NuGet package that was used to run docfx for

src/Interop/LlvmBindingsGenerator/LlvmBindingsGenerator.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222

2323
<!-- Sadly, the version range syntax doesn't work for Directory.Package.props so it must be provided here-->
2424
<!--
25-
NOTE: This isn't directly used by this project as it contains nothing consumable. However, it allows for scripts
26-
to restore this and guarantee the package is available when restored.
25+
NOTE: This isn't directly used by this project. However, it allows for scripts to restore this project, which
26+
guarantees the package is available, so they can use the contained headers as input to the application built
27+
by this project.
2728
-->
2829
<PackageReference Include="Ubiquity.NET.LibLLVM" VersionOverride="20.1.*-*" GeneratePathProperty="true" PrivateAssets="all" />
2930
</ItemGroup>

src/Samples/Kaleidoscope/IgnoredWords.dic

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ ifcont
3131
ifresult
3232
imag
3333
impl
34+
initializer
3435
inline
3536
inlined
3637
lexer

src/Samples/Kaleidoscope/Kaleidoscope.Grammar/AST/BinaryOperatorExpression.cs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,31 @@
88

99
namespace Kaleidoscope.Grammar.AST
1010
{
11+
/// <summary>Identifier for the kinds of built-in operators</summary>
1112
public enum BuiltInOperatorKind
1213
{
14+
/// <summary>Default value (Invalid)</summary>
1315
Invalid,
16+
17+
/// <summary>Assignment operator</summary>
1418
Assign,
19+
20+
/// <summary>Addition operator</summary>
1521
Add,
22+
23+
/// <summary>Subtraction operator</summary>
1624
Subtract,
25+
26+
/// <summary>Multiplication operator</summary>
1727
Multiply,
28+
29+
/// <summary>Division operator</summary>
1830
Divide,
31+
32+
/// <summary>Comparison operator (less)</summary>
1933
Less,
34+
35+
/// <summary>Exponentiation operator</summary>
2036
Pow
2137
}
2238

@@ -60,6 +76,10 @@ public sealed override IEnumerable<IAstNode> Children
6076
}
6177
}
6278

79+
/// <summary>Visitor pattern 'Accept' of a visitors that don't need a parameter</summary>
80+
/// <typeparam name="TResult">Type of the result from the visitor</typeparam>
81+
/// <param name="visitor">Visitor to apply for each node in this expression</param>
82+
/// <returns>Result of visiting this expression</returns>
6383
public override TResult? Accept<TResult>( IAstVisitor<TResult> visitor )
6484
where TResult : default
6585
{
@@ -68,6 +88,12 @@ public sealed override IEnumerable<IAstNode> Children
6888
: visitor.Visit( this );
6989
}
7090

91+
/// <summary>Visitor pattern 'Accept' of a visitors that need a parameter</summary>
92+
/// <typeparam name="TResult">Type of the result from the visitor</typeparam>
93+
/// <typeparam name="TArg">Type of the argument for the visit</typeparam>
94+
/// <param name="visitor">Visitor to apply for each node in this expression</param>
95+
/// <param name="arg">Argument to pass to each method of the visit</param>
96+
/// <returns>Result of visiting this expression</returns>
7197
public override TResult? Accept<TResult, TArg>( IAstVisitor<TResult, TArg> visitor, ref readonly TArg arg )
7298
where TResult : default
7399
{

src/Samples/Kaleidoscope/Kaleidoscope.Grammar/AST/ConditionalExpression.cs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,20 @@
88

99
namespace Kaleidoscope.Grammar.AST
1010
{
11+
/// <summary>AST node for a conditional expression</summary>
12+
/// <remarks>
13+
/// A conditional expression is the language equivalent of a conditional operator in most "C" like languages (ternary operator).
14+
/// </remarks>
1115
public sealed class ConditionalExpression
1216
: AstNode
1317
, IExpression
1418
{
19+
/// <summary>Initializes a new instance of the <see cref="ConditionalExpression"/> class.</summary>
20+
/// <param name="location">Location of the expression in the source input</param>
21+
/// <param name="condition">Expression for the condition</param>
22+
/// <param name="thenExpression">Expression for the `then` clause of the conditional expression</param>
23+
/// <param name="elseExpression">Expression for the `else` clause of the conditional expression</param>
24+
/// <param name="resultVar"><see cref="LocalVariableDeclaration"/> to represent the results of the expression</param>
1525
public ConditionalExpression( SourceRange location
1626
, IExpression condition
1727
, IExpression thenExpression
@@ -26,19 +36,26 @@ public ConditionalExpression( SourceRange location
2636
ResultVariable = resultVar;
2737
}
2838

39+
/// <summary>Gets the expression for the condition</summary>
2940
public IExpression Condition { get; }
3041

42+
/// <summary>Gets the expression for the `then` clause</summary>
3143
public IExpression ThenExpression { get; }
3244

45+
/// <summary>Gets the expression for the `else` clause</summary>
3346
public IExpression ElseExpression { get; }
3447

35-
// Compiler generated result variable supports building conditional
36-
// expressions without the need for SSA form in the AST/Code generation
37-
// by using mutable variables. The result is assigned a value from both
38-
// sides of the branch. In pure SSA form this isn't needed as a PHI node
39-
// would be used instead.
48+
/// <summary>Gets the result of the expression as a <see cref="LocalVariableDeclaration"/></summary>
49+
/// <remarks>
50+
/// Compiler generated result variable supports building conditional
51+
/// expressions without the need for SSA form in the AST/Code generation
52+
/// by using mutable variables. The result is assigned a value from both
53+
/// sides of the branch. In pure SSA form this isn't needed as a PHI node
54+
/// would be used instead.
55+
/// </remarks>
4056
public LocalVariableDeclaration ResultVariable { get; }
4157

58+
/// <inheritdoc cref="BinaryOperatorExpression.Accept{TResult}(IAstVisitor{TResult})"/>
4259
public override TResult? Accept<TResult>( IAstVisitor<TResult> visitor )
4360
where TResult : default
4461
{
@@ -47,6 +64,7 @@ public ConditionalExpression( SourceRange location
4764
: visitor.Visit( this );
4865
}
4966

67+
/// <inheritdoc cref="BinaryOperatorExpression.Accept{TResult, TArg}(IAstVisitor{TResult, TArg}, ref readonly TArg)"/>
5068
public override TResult? Accept<TResult, TArg>( IAstVisitor<TResult, TArg> visitor, ref readonly TArg arg )
5169
where TResult : default
5270
{
@@ -55,6 +73,7 @@ public ConditionalExpression( SourceRange location
5573
: visitor.Visit( this, in arg );
5674
}
5775

76+
/// <inheritdoc/>
5877
public override IEnumerable<IAstNode> Children
5978
{
6079
get
@@ -65,6 +84,7 @@ public override IEnumerable<IAstNode> Children
6584
}
6685
}
6786

87+
/// <inheritdoc/>
6888
public override string ToString( )
6989
{
7090
return $"Conditional({Condition}, {ThenExpression}, {ElseExpression})";

src/Samples/Kaleidoscope/Kaleidoscope.Grammar/AST/ConstantExpression.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,24 @@
99

1010
namespace Kaleidoscope.Grammar.AST
1111
{
12+
/// <summary>Kaleidoscope AST node for a constant</summary>
1213
public sealed class ConstantExpression
1314
: AstNode
1415
, IExpression
1516
{
17+
/// <summary>Initializes a new instance of the <see cref="ConstantExpression"/> class.</summary>
18+
/// <param name="location">Location of the expression in the original source</param>
19+
/// <param name="value">Value of the constant</param>
1620
public ConstantExpression( SourceRange location, double value )
1721
: base( location )
1822
{
1923
Value = value;
2024
}
2125

26+
/// <summary>Gets the value of this constant expression</summary>
2227
public double Value { get; }
2328

29+
/// <inheritdoc cref="BinaryOperatorExpression.Accept{TResult}(IAstVisitor{TResult})"/>
2430
public override TResult? Accept<TResult>( IAstVisitor<TResult> visitor )
2531
where TResult : default
2632
{
@@ -29,6 +35,7 @@ public ConstantExpression( SourceRange location, double value )
2935
: visitor.Visit( this );
3036
}
3137

38+
/// <inheritdoc cref="BinaryOperatorExpression.Accept{TResult, TArg}(IAstVisitor{TResult, TArg}, ref readonly TArg)"/>
3239
public override TResult? Accept<TResult, TArg>( IAstVisitor<TResult, TArg> visitor, ref readonly TArg arg )
3340
where TResult : default
3441
{
@@ -37,8 +44,10 @@ public ConstantExpression( SourceRange location, double value )
3744
: visitor.Visit( this, in arg );
3845
}
3946

47+
/// <inheritdoc/>
4048
public override IEnumerable<IAstNode> Children => [];
4149

50+
/// <inheritdoc/>
4251
public override string ToString( )
4352
{
4453
return Value.ToString( CultureInfo.CurrentCulture );

src/Samples/Kaleidoscope/Kaleidoscope.Grammar/AST/DiagnosticCode.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,44 @@
33

44
namespace Kaleidoscope.Grammar.AST
55
{
6+
/// <summary>Symbolic names for code values reported in diagnostic messages</summary>
67
public enum DiagnosticCode
78
: int
89
{
10+
/// <summary>No code value</summary>
911
None = 0,
1012

1113
// Codes with integer values < 1000 are reserved for grammar states
1214

1315
// AST Builder
16+
17+
/// <summary>Syntax error, input is not parsable</summary>
1418
SyntaxError = 1000,
19+
20+
/// <summary>Syntax indicates a variable but that symbol's name is unknown</summary>
1521
UnknownVariable,
22+
23+
/// <summary>Syntax indicates an invocation of a function but that function's name is unknown</summary>
1624
InvokeUnknownFunction,
25+
26+
/// <summary>Unary op expression is invalid</summary>
1727
InvalidUnaryOp,
28+
29+
/// <summary>Invalid reference to an operator</summary>
1830
InvalidUnaryOpRef,
31+
32+
/// <summary>Binary op expression is invalid</summary>
1933
InvalidBinaryOp,
34+
35+
/// <summary>Specified unary operator was not found</summary>
2036
UnaryOpNotFound,
37+
38+
/// <summary>Re-declaration is incompatible with the original</summary>
2139
IncompatibleRedclaration,
2240

2341
// Post parse
42+
43+
/// <summary>Parse was cancelled</summary>
2444
ParseCanceled = 2000,
2545
}
2646
}

src/Samples/Kaleidoscope/Kaleidoscope.Grammar/AST/ForInExpression.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@
88

99
namespace Kaleidoscope.Grammar.AST
1010
{
11+
/// <summary>Kaleidoscope AST node for a <c>ForIn</c> expression</summary>
1112
public sealed class ForInExpression
1213
: AstNode
1314
, IExpression
1415
{
16+
/// <summary>Initializes a new instance of the <see cref="ForInExpression"/> class.</summary>
17+
/// <param name="location">Location of the expression in the source input</param>
18+
/// <param name="loopVariable">Declaration of the variable to use for the loop</param>
19+
/// <param name="condition">Exit Condition for the loop</param>
20+
/// <param name="step">Step value to increment <paramref name="loopVariable"/> by with each iteration of the loop</param>
21+
/// <param name="body">The body of the loop to invoke on each iteration</param>
1522
public ForInExpression( SourceRange location
1623
, LocalVariableDeclaration loopVariable
1724
, IExpression condition
@@ -26,14 +33,19 @@ public ForInExpression( SourceRange location
2633
Body = body;
2734
}
2835

36+
/// <summary>Gets the declaration of the variable to use for the loop</summary>
2937
public LocalVariableDeclaration LoopVariable { get; }
3038

39+
/// <summary>Gets the exit Condition for the loop</summary>
3140
public IExpression Condition { get; }
3241

42+
/// <summary>Gets the step value to increment <see cref="LoopVariable"/> by with each iteration of the loop</summary>
3343
public IExpression Step { get; }
3444

45+
/// <summary>Gets the body of the loop to invoke on each iteration</summary>
3546
public IExpression Body { get; }
3647

48+
/// <inheritdoc cref="BinaryOperatorExpression.Accept{TResult}(IAstVisitor{TResult})"/>
3749
public override TResult? Accept<TResult>( IAstVisitor<TResult> visitor )
3850
where TResult : default
3951
{
@@ -42,6 +54,7 @@ public ForInExpression( SourceRange location
4254
: visitor.Visit( this );
4355
}
4456

57+
/// <inheritdoc cref="BinaryOperatorExpression.Accept{TResult, TArg}(IAstVisitor{TResult, TArg}, ref readonly TArg)"/>
4558
public override TResult? Accept<TResult, TArg>( IAstVisitor<TResult, TArg> visitor, ref readonly TArg arg )
4659
where TResult : default
4760
{
@@ -50,6 +63,7 @@ public ForInExpression( SourceRange location
5063
: visitor.Visit( this, in arg );
5164
}
5265

66+
/// <inheritdoc/>
5367
public override IEnumerable<IAstNode> Children
5468
{
5569
get
@@ -61,6 +75,7 @@ public override IEnumerable<IAstNode> Children
6175
}
6276
}
6377

78+
/// <inheritdoc/>
6479
public override string ToString( )
6580
{
6681
return $"for({LoopVariable}, {Condition}, {Step}, {Body})";

src/Samples/Kaleidoscope/Kaleidoscope.Grammar/AST/FunctionCallExpression.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,29 @@
99

1010
namespace Kaleidoscope.Grammar.AST
1111
{
12+
/// <summary>Kaleidoscope AST Node for a function call expression</summary>
1213
public sealed class FunctionCallExpression
1314
: AstNode
1415
, IExpression
1516
{
17+
/// <summary>Initializes a new instance of the <see cref="FunctionCallExpression"/> class.</summary>
18+
/// <param name="location">Location of the node in the source input</param>
19+
/// <param name="functionPrototype">Prototype of the function to call</param>
20+
/// <param name="args">Arguments to provide to the function</param>
1621
public FunctionCallExpression( SourceRange location, Prototype functionPrototype, params IEnumerable<IExpression> args )
1722
: base( location )
1823
{
1924
FunctionPrototype = functionPrototype;
2025
Arguments = [ .. args ];
2126
}
2227

28+
/// <summary>Gets the prototype of the function to call</summary>
2329
public Prototype FunctionPrototype { get; }
2430

31+
/// <summary>Gets the arguments to provide to the function</summary>
2532
public IReadOnlyList<IExpression> Arguments { get; }
2633

34+
/// <inheritdoc/>
2735
public override IEnumerable<IAstNode> Children
2836
{
2937
get
@@ -32,6 +40,7 @@ public override IEnumerable<IAstNode> Children
3240
}
3341
}
3442

43+
/// <inheritdoc cref="BinaryOperatorExpression.Accept{TResult}(IAstVisitor{TResult})"/>
3544
public override TResult? Accept<TResult>( IAstVisitor<TResult> visitor )
3645
where TResult : default
3746
{
@@ -40,6 +49,7 @@ public override IEnumerable<IAstNode> Children
4049
: visitor.Visit( this );
4150
}
4251

52+
/// <inheritdoc cref="BinaryOperatorExpression.Accept{TResult, TArg}(IAstVisitor{TResult, TArg}, ref readonly TArg)"/>
4353
public override TResult? Accept<TResult, TArg>( IAstVisitor<TResult, TArg> visitor, ref readonly TArg arg )
4454
where TResult : default
4555
{
@@ -48,6 +58,7 @@ public override IEnumerable<IAstNode> Children
4858
: visitor.Visit( this, in arg );
4959
}
5060

61+
/// <inheritdoc/>
5162
public override string ToString( )
5263
{
5364
return Arguments.Count == 0

0 commit comments

Comments
 (0)