aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml1
-rw-r--r--README.md5
-rw-r--r--docs/ARCHITECTURE.md1
-rw-r--r--docs/CONTRIBUTING.md32
-rw-r--r--docs/TESTS.md30
-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 @@
2name = "libsyntax2" 2name = "libsyntax2"
3version = "0.1.0" 3version = "0.1.0"
4authors = ["Aleksey Kladov <[email protected]>"] 4authors = ["Aleksey Kladov <[email protected]>"]
5license = "MIT OR Apache-2.0"
5 6
6[dependencies] 7[dependencies]
7unicode-xid = "0.1.0" 8unicode-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
3libsyntax2.0 is an **experimental** implementation of the corresponding [RFC](https://github.com/rust-lang/rfcs/pull/2256).
4
5See `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 @@
1The project is in its early stages: contributions are welcome and
2would be **very** helpful, but the project is not *yet* optimized for
3contributors. Moreover, it is doubly experimental, so there's no
4guarantee that any work here would reach production. That said, here
5are 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
31Do take a look at the issue tracker, and try to read other docs in
32this 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
3Libsyntax2.0 tests are in the `tests/data` directory. Each test is a
4pair of files, an `.rs` file with Rust code and a `.txt` file with a
5human-readable representation of syntax tree.
6
7The test suite is intended to be independent from a particular parser:
8that's why it is just a list of files.
9
10The test suite is intended to be progressive: that is, if you want to
11write a Rust parser, you can TDD it by working through the test in
12order. That's why each test file begins with the number. Generally,
13tests should be added in order of the appearance of corresponding
14functionality in libsytnax2.0. If a bug in parser is uncovered, a
15**new** test should be created instead of modifying an existing one:
16it is preferable to have a gazillion of small isolated test files,
17rather than a single file which covers all edge cases. It's okay for
18files to have the same name except for the leading number. In general,
19test suite should be append-only: old tests should not be modified,
20new tests should be created instead.
21
22
23Note that only `ok` tests are normative: `err` tests test error
24recovery and it is totally ok for a parser to not implement any error
25recovery at all. However, for libsyntax2.0 we do care about error
26recovery, and we do care about precise and useful error messages.
27
28
29Contribution opportunity: design and implement testing infrastructure
30for validators.
diff --git a/rfc.md b/docs/rfc.md
index 2bd9f18f1..2bd9f18f1 100644
--- a/rfc.md
+++ b/docs/rfc.md
diff --git a/validation.md b/docs/validation.md
index 2739bfcdd..2739bfcdd 100644
--- a/validation.md
+++ b/docs/validation.md