diff options
-rw-r--r-- | ARCHITECTURE.md | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 823db0034..b326f9c71 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md | |||
@@ -20,7 +20,7 @@ memory and never does any IO. Because the input data is source code, which | |||
20 | typically measures in tens of megabytes at most, keeping all input data in | 20 | typically measures in tens of megabytes at most, keeping all input data in |
21 | memory is OK. | 21 | memory is OK. |
22 | 22 | ||
23 | A "structured semantic model" is basically an object-oriented representations of | 23 | A "structured semantic model" is basically an object-oriented representation of |
24 | modules, functions and types which appear in the source code. This representation | 24 | modules, functions and types which appear in the source code. This representation |
25 | is fully "resolved": all expressions have types, all references are bound to | 25 | is fully "resolved": all expressions have types, all references are bound to |
26 | declarations, etc. | 26 | declarations, etc. |
@@ -90,29 +90,29 @@ fixes a bug in the grammar. | |||
90 | We use [salsa][https://github.com/salsa-rs/salsa] crate for incremental and | 90 | We use [salsa][https://github.com/salsa-rs/salsa] crate for incremental and |
91 | on-demand computation. Roughly, you can think of salsa as a key-value store, but | 91 | on-demand computation. Roughly, you can think of salsa as a key-value store, but |
92 | it also can compute derived values using specified functions. The `ra_db` crate | 92 | it also can compute derived values using specified functions. The `ra_db` crate |
93 | provides a basic infrastructure for interracting with salsa. Crucially, it | 93 | provides a basic infrastructure for interacting with salsa. Crucially, it |
94 | defines most of the "input" queries: facts supplied by the client of the | 94 | defines most of the "input" queries: facts supplied by the client of the |
95 | analyzer. Reading the docs of the `ra_db::input` module should be useful: | 95 | analyzer. Reading the docs of the `ra_db::input` module should be useful: |
96 | everithing else is strictly derived from thouse inputs. | 96 | everything else is strictly derived from those inputs. |
97 | 97 | ||
98 | ### `crates/ra_hir` | 98 | ### `crates/ra_hir` |
99 | 99 | ||
100 | HIR provides a high-level "object oriented" acess to Rust code. | 100 | HIR provides high-level "object oriented" access to Rust code. |
101 | 101 | ||
102 | The principal difference between HIR and syntax trees is that HIR is bound to a | 102 | The principal difference between HIR and syntax trees is that HIR is bound to a |
103 | particular crate instance. That is, it has cfg flags and features applied (in | 103 | particular crate instance. That is, it has cfg flags and features applied (in |
104 | theory, in practice this is to be implemented). So, there relation between | 104 | theory, in practice this is to be implemented). So, the relation between |
105 | syntax and HIR is many-to-one. The `source_binder` modules is responsible for | 105 | syntax and HIR is many-to-one. The `source_binder` modules is responsible for |
106 | guessing a hir for a particular source position. | 106 | guessing a HIR for a particular source position. |
107 | 107 | ||
108 | Underneath, hir works on top of salsa, using a `HirDatabase` trait. | 108 | Underneath, HIR works on top of salsa, using a `HirDatabase` trait. |
109 | 109 | ||
110 | ### `crates/ra_analysis` | 110 | ### `crates/ra_analysis` |
111 | 111 | ||
112 | A stateful library for analyzing many Rust files as they change. | 112 | A stateful library for analyzing many Rust files as they change. |
113 | `AnalysisHost` is a mutable entity (clojure's atom) which holds | 113 | `AnalysisHost` is a mutable entity (clojure's atom) which holds the |
114 | current state, incorporates changes and handles out `Analysis` --- an | 114 | current state, incorporates changes and handles out `Analysis` --- an |
115 | immutable consistent snapshot of world state at a point in time, which | 115 | immutable and consistent snapshot of world state at a point in time, which |
116 | actually powers analysis. | 116 | actually powers analysis. |
117 | 117 | ||
118 | One interesting aspect of analysis is its support for cancellation. When a change | 118 | One interesting aspect of analysis is its support for cancellation. When a change |
@@ -137,7 +137,7 @@ without the need to fiddle with build-systems, file | |||
137 | synchronization and such. | 137 | synchronization and such. |
138 | 138 | ||
139 | In a sense, `ra_editor` is just a bunch of pure functions which take a | 139 | In a sense, `ra_editor` is just a bunch of pure functions which take a |
140 | syntax tree as an input. | 140 | syntax tree as input. |
141 | 141 | ||
142 | The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread | 142 | The tests for `ra_editor` are `#[cfg(test)] mod tests` unit-tests spread |
143 | throughout its modules. | 143 | throughout its modules. |