Skip to content

Commit 74efb52

Browse files
authored
Draft semantic index (#1143)
Part of #1141 Implements scopes and symbol tables. Prelude to implementing use-def maps. To get oriented: - See comments documenting the new data structures in `src/semantic_index.rs` - See `tests/builder.rs` documenting the behaviour of the recursive descent in `src/builder.rs`.
2 parents e12059c + 399ba8b commit 74efb52

9 files changed

Lines changed: 2269 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,19 @@ The codebase is organized as a Rust workspace containing multiple crates:
1919
- **harp**: Rust wrappers for R objects and interfaces
2020
- **libr**: Bindings to R (dynamically loaded using `dlopen`/`LoadLibrary`)
2121
- **amalthea**: A Rust framework for building Jupyter and Positron kernels
22+
- **oak_index**: Per-file semantic index for R (scopes, symbols, definitions, uses)
2223
- **echo**: A toy kernel for testing the kernel framework
2324
- **stdext**: Extensions to Rust's standard library used by the other projects
2425

26+
### External dependencies (R parser)
27+
28+
The `oak_index` and `ark` crates depend on the R parser from [posit-dev/air](https://github.com/posit-dev/air), pinned by git revision in the workspace `Cargo.toml`. The relevant crates are re-exported under `aether_` prefixes:
29+
30+
- **`aether_syntax`** (`air_r_syntax`): Typed CST nodes (`RIdentifier`, `RBinaryExpression`, `RFunctionDefinition`, etc.), `RSyntaxKind`, `RSyntaxNode`, `RSyntaxToken`.
31+
- **`aether_parser`** (`air_r_parser`): `parse()` function that produces an `RRoot` CST.
32+
33+
Source code for these crates lives in `posit-dev/air` under `crates/air_r_syntax/` and `crates/air_r_parser/`. When looking up type definitions, AST node variants, or syntax kinds, consult that repository.
34+
2535
## Common Development Commands
2636

2737
### Building the Project

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ members = [
1515
"crates/echo",
1616
"crates/harp",
1717
"crates/libr",
18+
"crates/oak_index",
1819
"crates/stdext",
1920
]
2021

@@ -74,6 +75,7 @@ log = "0.4.18"
7475
mime_guess = "2.0.4"
7576
nix = { version = "0.26.2", features = ["signal"] }
7677
notify = "6.0.0"
78+
oak_index = { path = "crates/oak_index" }
7779
once_cell = "1.17.1"
7880
parking_lot = "0.12.3"
7981
paste = "1.0.14"

crates/oak_index/Cargo.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "oak_index"
3+
version = "0.1.0"
4+
description = """
5+
Per-file semantic index for R: scopes, symbols, bindings, and uses.
6+
"""
7+
8+
authors.workspace = true
9+
edition.workspace = true
10+
license.workspace = true
11+
rust-version.workspace = true
12+
13+
[lints]
14+
workspace = true
15+
16+
[dependencies]
17+
aether_syntax.workspace = true
18+
biome_rowan.workspace = true
19+
rustc-hash.workspace = true
20+
21+
[dev-dependencies]
22+
aether_parser.workspace = true

0 commit comments

Comments
 (0)