diff options
-rw-r--r-- | Cargo.toml | 1 | ||||
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | docs/ARCHITECTURE.md | 1 | ||||
-rw-r--r-- | docs/CONTRIBUTING.md | 32 | ||||
-rw-r--r-- | docs/TESTS.md | 30 | ||||
-rw-r--r-- | docs/rfc.md (renamed from rfc.md) | 0 | ||||
-rw-r--r-- | docs/validation.md (renamed from validation.md) | 0 |
7 files changed, 69 insertions, 0 deletions
diff --git a/Cargo.toml b/Cargo.toml index 043f97752..802a99b37 100644 --- a/Cargo.toml +++ b/Cargo.toml | |||
@@ -2,6 +2,7 @@ | |||
2 | name = "libsyntax2" | 2 | name = "libsyntax2" |
3 | version = "0.1.0" | 3 | version = "0.1.0" |
4 | authors = ["Aleksey Kladov <[email protected]>"] | 4 | authors = ["Aleksey Kladov <[email protected]>"] |
5 | license = "MIT OR Apache-2.0" | ||
5 | 6 | ||
6 | [dependencies] | 7 | [dependencies] |
7 | unicode-xid = "0.1.0" | 8 | unicode-xid = "0.1.0" |
diff --git a/README.md b/README.md new file mode 100644 index 000000000..78bcc89b3 --- /dev/null +++ b/README.md | |||
@@ -0,0 +1,5 @@ | |||
1 | # libsyntax2.0 | ||
2 | |||
3 | libsyntax2.0 is an **experimental** implementation of the corresponding [RFC](https://github.com/rust-lang/rfcs/pull/2256). | ||
4 | |||
5 | See `docs` folder for more details. \ No newline at end of file | ||
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 000000000..5b50f8faa --- /dev/null +++ b/docs/ARCHITECTURE.md | |||
@@ -0,0 +1 @@ | |||
# Design and open questions about libsyntax. | |||
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md new file mode 100644 index 000000000..5ae2e830e --- /dev/null +++ b/docs/CONTRIBUTING.md | |||
@@ -0,0 +1,32 @@ | |||
1 | The project is in its early stages: contributions are welcome and | ||
2 | would be **very** helpful, but the project is not *yet* optimized for | ||
3 | contributors. Moreover, it is doubly experimental, so there's no | ||
4 | guarantee that any work here would reach production. That said, here | ||
5 | are some arias where contributions would be **especially** welcome: | ||
6 | |||
7 | |||
8 | * Designing internal data structures: RFC only outlines the | ||
9 | constraints, it's an open question how to satisfy them in the | ||
10 | optimal way. See `ARCHITECTURE.md` for current design questions. | ||
11 | |||
12 | * Porting libsyntax parser to libsyntax2: currently libsyntax2 parses | ||
13 | only a tiny subset of Rust. This should be fixed by porting parsing | ||
14 | functions from libsyntax one by one. | ||
15 | |||
16 | * Writing validators: by design, libsyntax2 is very lax about the | ||
17 | input. For example, the lexer happily accepts unclosed strings. The | ||
18 | idea is that there should be a higher level visitor, which walks the | ||
19 | syntax tree after parsing and produces all the warnings. Alas, | ||
20 | there's no such visitor yet :( Would you like to write one? :) | ||
21 | |||
22 | * Creating tests: it would be tremendously helpful to read each of | ||
23 | libsyntax and libsyntax2 parser functions and crate a small separate | ||
24 | test cases to cover each and every edge case. | ||
25 | |||
26 | * Building stuff with libsyntax2: it would be really cool to compile | ||
27 | libsyntax2 to WASM and add *client side* syntax validation to rust | ||
28 | playground! | ||
29 | |||
30 | |||
31 | Do take a look at the issue tracker, and try to read other docs in | ||
32 | this folder. | ||
diff --git a/docs/TESTS.md b/docs/TESTS.md new file mode 100644 index 000000000..8005ec9da --- /dev/null +++ b/docs/TESTS.md | |||
@@ -0,0 +1,30 @@ | |||
1 | # libsyntax2.0 testing infrastructure | ||
2 | |||
3 | Libsyntax2.0 tests are in the `tests/data` directory. Each test is a | ||
4 | pair of files, an `.rs` file with Rust code and a `.txt` file with a | ||
5 | human-readable representation of syntax tree. | ||
6 | |||
7 | The test suite is intended to be independent from a particular parser: | ||
8 | that's why it is just a list of files. | ||
9 | |||
10 | The test suite is intended to be progressive: that is, if you want to | ||
11 | write a Rust parser, you can TDD it by working through the test in | ||
12 | order. That's why each test file begins with the number. Generally, | ||
13 | tests should be added in order of the appearance of corresponding | ||
14 | functionality in libsytnax2.0. If a bug in parser is uncovered, a | ||
15 | **new** test should be created instead of modifying an existing one: | ||
16 | it is preferable to have a gazillion of small isolated test files, | ||
17 | rather than a single file which covers all edge cases. It's okay for | ||
18 | files to have the same name except for the leading number. In general, | ||
19 | test suite should be append-only: old tests should not be modified, | ||
20 | new tests should be created instead. | ||
21 | |||
22 | |||
23 | Note that only `ok` tests are normative: `err` tests test error | ||
24 | recovery and it is totally ok for a parser to not implement any error | ||
25 | recovery at all. However, for libsyntax2.0 we do care about error | ||
26 | recovery, and we do care about precise and useful error messages. | ||
27 | |||
28 | |||
29 | Contribution opportunity: design and implement testing infrastructure | ||
30 | for validators. | ||
diff --git a/validation.md b/docs/validation.md index 2739bfcdd..2739bfcdd 100644 --- a/validation.md +++ b/docs/validation.md | |||