Skip to content

Commit

Permalink
Merge pull request #146 from quentin/doccomments
Browse files Browse the repository at this point in the history
doc comments and annotations
  • Loading branch information
quentin authored Mar 5, 2024
2 parents 1355ba8 + ecae96c commit 62dbdff
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
7 changes: 6 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ source "https://rubygems.org"
# to publish on github page
gem 'github-pages', group: :jekyll_plugins

# to publich without github page
# to publish without github page (for local test):
# - un-comment these:
#gem "jekyll"
#gem "webrick"
# - remove Gemfile.lock file
# - run `bundle install`
# - run `bundle exec jekyll serve --watch`
35 changes: 34 additions & 1 deletion pages/docs/programs.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ Pragmas configure Soufflé. For example, command-line options can be set in the

### Comments

Soufflé utilises the same comment syntax as C/C++. Inline comments starts with `//` anywhere outside of a comment and extend to the end of the line. Block comments starts with `/*` anywhere outside of a comment and extend to the first occurence of `*/`.
Soufflé utilises the same comment syntax as C/C++. Inline comments starts with
`//` anywhere outside of a comment and extend to the end of the line. Block
comments starts with `/*` anywhere outside of a comment and extend to the first
occurence of `*/`.

```c
// an inline comment
Expand All @@ -105,6 +108,36 @@ Soufflé utilises the same comment syntax as C/C++. Inline comments starts with
*/
```

### Documentation comments & annotations

[![Static Badge](https://img.shields.io/badge/since_%232472-blue)](https://github.com/souffle-lang/souffle/pull/2472) Documentation comments and annotations are part of the syntax.
The design is close to Rust's *attributes*. A documentation comment is a syntactic sugar for a `doc` annotation.

For an optimal usage of documentation comments and annotations, [disable the C preprocessor](#syntax-without-c-pre-processor) with `--no-preprocessor`.

All program's and component's items can have outer annotations of the form `@[annotation]` or `/// doc comment`. Attributes and ADT branches also accept outer annotations.

Some items can have inner annotations of the form `@![annotation]` or `//! doc comment`:
- after `{` of a component, before the first component's item.
- after `{` of an ADT branch, before the first attribute of the branch.
- after `:-` of a clause, before the first constraint.

Annotations and doc comments should not appear before `.include` or before any `}` or before the end of a file.

```c
/// The documentation comment
/// for relation `R`
.decl R()

/// doc comment for `C`
@[doc = "more outer documentation"]
.comp C {
//! inner doc comment
//! for `C`
@![doc = "more inner documentation"]
}
```

### Identifiers

Soufflé Identifiers follow the C++ naming convention, except that a question mark may appear anywhere.
Expand Down

0 comments on commit 62dbdff

Please sign in to comment.