Skip to content

Commit 6eacbd5

Browse files
committed
Add CONTRIBUTING.md
1 parent c5038cb commit 6eacbd5

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

CONTRIBUTING.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Contributors Guide
2+
3+
First off, thanks a lot for contributing to Balloon! :D
4+
5+
## Setup
6+
7+
Balloon is written in Rust. You'll need to get a working installation of Rust and Cargo to be able to work on Balloon. The [Rust websites's installation instructions page](https://www.rust-lang.org/en-US/install.html) should give you the necessary information. Remember to configure the `$PATH` environment variable (if necessary) as mentioned in the guide. You can get the latest nightly version of the compiler or the stable version - balloon should build fine in both.
8+
9+
After this, you can run the REPL:
10+
11+
```
12+
$ cargo run
13+
```
14+
15+
You can also build the binary and use it directly as mentioned in the [readme](README.md).
16+
17+
```
18+
$ cargo build
19+
$ ./target/debug/balloon [args]
20+
```
21+
22+
If you want to work on the LLVM backend, you'll need to install LLVM (look at the apt packages listed in [.travis.yml](.travis.yml)) and then run cargo with the "llvm-backend" feature.
23+
24+
```
25+
$ cargo build --features "llvm-backend"
26+
```
27+
28+
## Project structure for contributions
29+
30+
Say you want to add a new language construct to Balloon. The process looks roughly as follows:
31+
32+
1. Make the necessary changes to the `struct`s and `enum`s in the [src/ast.rs](src/ast.rs) file.
33+
1. Edit the PEG grammar file at [src/grammar.rustpeg](src/grammar.rustpeg).
34+
1. Try building once using `cargo build`. If there's an error in the grammar or the AST, it'll show up now. If those parts are fine, you'll see an error because some case isn't handled in [src/ast_walk_interpreter.rs](src/ast_walk_interpreter.rs) and in [src/typechecker.rs](src/typechecker.rs).
35+
1. Find the relevant cases in the AST-walk interpreter and the typechecker and add in the relevant code.
36+
1. Build and test the feature manually to see if it works. (Unless you're doing something cool like TDD.)
37+
1. Write tests. Look at the [tests/](tests/) directory for examples.
38+
- run-pass: Files that should run without errors
39+
- run-fail: Files that should given an error when run, specified in the respective .err file
40+
- typecheck-pass: Files that should typecheck without errors
41+
- typecheck-fail: Files that should give an error when typechecked, specified in the respective .err file
42+
1. If everything looks good, commit and push your change. While there aren't any concrete rules yet, follow the commonly used imperative style, without a trailing period. Look at previous commits to get an idea of how your commit should look.
43+
1. Send in a PR!

0 commit comments

Comments
 (0)