Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds autodocumentation features to Forge, implemented as sphinx as a new backend from Forge DSL specs.
Documentation auto-generated for OptiML
Features
Implemented in preprocessor + backend gen rules
@dsl Preprocessor Annotation
Syntax:
@dsl
as an annotation on DSL spec traitPurpose: Used at the top of a file to tell the preprocessor to look for comment blocks in the DSL spec. Not required, but the preprocessor may miss the first comment if this isn't included in the spec file.
DSL Description Blocks
Syntax: Comment block with 3 asterisks
Purpose: Used to populate the introduction page in the generated documentation.
Note: Only one is allowed per DSL - if more than one is used, the last one seen by the compiler is used.
Type/Method Description Comment Blocks
Syntax: Comment block with 2 asterisks
Purpose: Used to describe DSL types, methods, their parameters, and their return value. @param and @returns are optional.
Note: The generator uses signature order to match @param descriptions up with corresponding parameters, and will warn the DSL author if there is a mismatch in number of @param descriptions versus actual method parameters.
Parameter name in documentation is chosen in the following order:
NoDoc "Annotation"
Syntax: ```/** @Nodoc **/
Purpose: Used to tell the generator that the specified method should not be included in the DSL documentation.
Note:By default, compiler methods and methods starting with "forge_" are not documented.
Notes
Parsing comment blocks only occurs if the preprocessor is not in a method (e.g. implementation/generation rule) scope, so comments in code generation rules and the like should still be safe. Comment blocks beginning with only one asterisk and single line comments are never preprocessed.
Markup is technically supported in comment blocks, but may be a little buggy right now.
Documentation is currently automatically grouped into the following 6 categories:
TODOs:
e.g. (from OptiML's classifier):
def logreg(data: Rep[TS[Double,:doc:boolean]]