Skip to content

Commit f90921b

Browse files
authored
Create CONTRIBUTING.md
1 parent 11e0138 commit f90921b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

CONTRIBUTING.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
# Contributing
3+
The repository itself is simple to set up. Simply clone the repository and build it with [cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html).
4+
There are no extra dependencies one needs for building the repository as-is.
5+
6+
```sh
7+
git clone https://github.com/pc2/sus-compiler.git
8+
```
9+
10+
And build it:
11+
```sh
12+
cargo build
13+
```
14+
15+
To edit the tree-sitter grammar and regenerate [tree-sitter-sus/src/parser.c](./tree-sitter_sus/src/parser.c), you will need [`tree-sitter-cli`](https://docs.rs/tree-sitter-cli/latest/tree_sitter_cli/).
16+
17+
To avoid headaches due to mismatching versions, we use `tree-sitter-cli v0.24.7`
18+
```sh
19+
cargo install [email protected]
20+
```
21+
22+
You can use the [tree-sitter-sus/tree.sh](tree-sitter-sus/tree.sh) script to regenerate the parser, and show some useful information about it.
23+
24+
## Formatting and clippy
25+
We require all contributions to be run through `cargo fmt` and that no warnings remain.
26+
27+
### VSCode
28+
Add the following to your `.vscode/settings.json`
29+
```json
30+
"[rust]": {
31+
"editor.defaultFormatter": "rust-lang.rust-analyzer",
32+
"editor.formatOnSave": true
33+
},
34+
"rust-analyzer.check.command": "clippy"
35+
```
36+
37+
## Behavior-altering changes
38+
To better defend against regressions during development, we require that any change that alters the _behavior_ of the compiler (IE, adding or changing diagnostics, or altering the test file [test.sus](test.sus)) also commits the changed effects.
39+
This can be done by simply re-running
40+
```sh
41+
./test.sus_regression.sh
42+
```
43+
Afterwards, inspect the changes to [test.sus_output.txt](./test.sus_output.txt) and [test.sus_errors.txt](./test.sus_errors.txt) before committing.

0 commit comments

Comments
 (0)