Skip to content

Commit af48bfc

Browse files
committed
build: rename crate from pac to parc
1 parent 917d1a2 commit af48bfc

25 files changed

Lines changed: 191 additions & 193 deletions

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[package]
2-
name = "pac"
2+
name = "parc"
33
version = "0.16.0"
44
authors = ["Vickenty Fesunov <kent@setattr.net>"]
55
edition = "2021"
66
license = "MIT/Apache-2.0"
77
description = "C language frontend: preprocessing, parsing, and source-level semantic extraction"
88
include = [ "/src/**/*.rs", "Cargo.toml", "/LICENSE*", "/README.md" ]
9-
documentation = "https://docs.rs/pac"
9+
documentation = "https://docs.rs/parc"
1010
homepage = "https://github.com/vickenty/lang-c"
1111
repository = "https://github.com/vickenty/lang-c"
1212
keywords = [ "ast", "c", "parser", "ffi", "preprocessing" ]

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
# PAC (parser c)
1+
# PARC
22

3-
[![Documentation](https://docs.rs/pac/badge.svg)](https://docs.rs/pac)
3+
[![Documentation](https://docs.rs/parc/badge.svg)](https://docs.rs/parc)
44

5-
PAC (parser c) is a lightweight parser of the C language for Rust users. Almost full support for the C11 revision of the language.
6-
Several GCC and Clang extensions are also supported as an option.
5+
PARC is a C language frontend: preprocessing, parsing, and source-level semantic extraction.
6+
Full support for C11 with GNU and Clang extensions.
77

88
```rust
9-
extern crate pac;
10-
use pac::driver::{Config, parse};
9+
use parc::driver::{Config, parse};
1110

1211
fn main() {
1312
let config = Config::default();
@@ -17,7 +16,7 @@ fn main() {
1716

1817
# Bugs
1918

20-
Just open an issue, bug reports and patches are most welcome.
19+
Just open an issue, bug reports and patches are most welcome.
2120

2221
## License
2322

book/book.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[book]
22
authors = ["Trim Bresilla"]
33
language = "en"
4-
title = "PAC Reference"
4+
title = "PARC Reference"
55

66
[output.html]
77
default-theme = "navy"

book/src/010_getting_started.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
```toml
66
[dependencies]
7-
pac = { path = "../pac" }
7+
parc = { path = "../pac" }
88
```
99

1010
## Pick the right API first
1111

12-
Use `pac::driver` when you have a file on disk and want PAC to run a system preprocessor first.
12+
Use `parc::driver` when you have a file on disk and want PAC to run a system preprocessor first.
1313

1414
```rust
15-
use pac::driver::{parse, Config};
15+
use parc::driver::{parse, Config};
1616

17-
fn main() -> Result<(), pac::driver::Error> {
17+
fn main() -> Result<(), parc::driver::Error> {
1818
let config = Config::default();
1919
let parsed = parse(&config, "examples/sample.c")?;
2020

@@ -24,11 +24,11 @@ fn main() -> Result<(), pac::driver::Error> {
2424
}
2525
```
2626

27-
Use `pac::parse` when you already have source text in memory and want to parse a fragment directly.
27+
Use `parc::parse` when you already have source text in memory and want to parse a fragment directly.
2828

2929
```rust
30-
use pac::driver::Flavor;
31-
use pac::parse;
30+
use parc::driver::Flavor;
31+
use parc::parse;
3232

3333
fn main() {
3434
let expr = parse::expression("a + b * 2", Flavor::StdC11).unwrap();
@@ -54,7 +54,7 @@ For file-based parsing, `Config::default()` selects:
5454
You can also select explicitly:
5555

5656
```rust
57-
use pac::driver::Config;
57+
use parc::driver::Config;
5858

5959
let gnu = Config::with_gcc();
6060
let clang = Config::with_clang();
@@ -65,9 +65,9 @@ let clang = Config::with_clang();
6565
This example parses a translation unit and counts top-level entries:
6666

6767
```rust
68-
use pac::driver::{parse, Config};
68+
use parc::driver::{parse, Config};
6969

70-
fn main() -> Result<(), pac::driver::Error> {
70+
fn main() -> Result<(), parc::driver::Error> {
7171
let parsed = parse(&Config::default(), "examples/header.h")?;
7272

7373
for (i, item) in parsed.unit.0.iter().enumerate() {
@@ -83,8 +83,8 @@ fn main() -> Result<(), pac::driver::Error> {
8383
If you only need one declaration or statement, the direct parser API is faster to wire in:
8484

8585
```rust
86-
use pac::driver::Flavor;
87-
use pac::parse;
86+
use parc::driver::Flavor;
87+
use parc::parse;
8888

8989
fn main() {
9090
let decl = parse::declaration("static const int answer = 42;", Flavor::StdC11).unwrap();

book/src/015_workflows.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ the right API.
1818
Use this when your source depends on `#include`, `#define`, or compiler predefined macros.
1919

2020
```rust
21-
use pac::driver::{parse, Config};
21+
use parc::driver::{parse, Config};
2222

2323
let config = Config::default();
2424
let parsed = parse(&config, "src/main.c")?;
@@ -34,7 +34,7 @@ This gives you:
3434
Use this when another tool already ran preprocessing and you only want PAC to parse.
3535

3636
```rust
37-
use pac::driver::{parse_preprocessed, Config};
37+
use parc::driver::{parse_preprocessed, Config};
3838

3939
let config = Config::default();
4040
let source = r#"
@@ -55,11 +55,11 @@ This is useful for:
5555

5656
## Parse a fragment
5757

58-
Use `pac::parse` when you are not dealing with a whole file.
58+
Use `parc::parse` when you are not dealing with a whole file.
5959

6060
```rust
61-
use pac::driver::Flavor;
62-
use pac::parse;
61+
use parc::driver::Flavor;
62+
use parc::parse;
6363

6464
let expr = parse::expression("ptr->len + 1", Flavor::GnuC11)?;
6565
let decl = parse::declaration("unsigned long flags;", Flavor::StdC11)?;
@@ -83,9 +83,9 @@ The normal analyzer flow is:
8383
Example outline:
8484

8585
```rust
86-
use pac::driver::{parse, Config};
87-
use pac::visit::{self, Visit};
88-
use pac::{ast, span};
86+
use parc::driver::{parse, Config};
87+
use parc::visit::{self, Visit};
88+
use parc::{ast, span};
8989

9090
struct FunctionCounter {
9191
count: usize,
@@ -106,24 +106,24 @@ let parsed = parse(&Config::default(), "src/main.c")?;
106106
let mut counter = FunctionCounter { count: 0 };
107107
counter.visit_translation_unit(&parsed.unit);
108108
println!("functions: {}", counter.count);
109-
# Ok::<(), pac::driver::Error>(())
109+
# Ok::<(), parc::driver::Error>(())
110110
```
111111

112112
## Debug the parse tree
113113

114114
Use the printer when you need a human-readable structural dump:
115115

116116
```rust
117-
use pac::driver::{parse, Config};
118-
use pac::print::Printer;
119-
use pac::visit::Visit;
117+
use parc::driver::{parse, Config};
118+
use parc::print::Printer;
119+
use parc::visit::Visit;
120120

121121
let parsed = parse(&Config::default(), "src/main.c")?;
122122

123123
let mut out = String::new();
124124
Printer::new(&mut out).visit_translation_unit(&parsed.unit);
125125
println!("{}", out);
126-
# Ok::<(), pac::driver::Error>(())
126+
# Ok::<(), parc::driver::Error>(())
127127
```
128128

129129
## Rule of thumb

book/src/020_driver.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ The return value matters:
3232
## Basic file parsing
3333

3434
```rust
35-
use pac::driver::{parse, Config};
35+
use parc::driver::{parse, Config};
3636

3737
let config = Config::default();
3838
let parsed = parse(&config, "examples/demo.c")?;
3939

4040
println!("preprocessed bytes: {}", parsed.source.len());
4141
println!("top-level nodes: {}", parsed.unit.0.len());
42-
# Ok::<(), pac::driver::Error>(())
42+
# Ok::<(), parc::driver::Error>(())
4343
```
4444

4545
## Configuring the preprocessor
4646

4747
You can override both the preprocessor executable and its arguments.
4848

4949
```rust
50-
use pac::driver::{parse, Config, Flavor};
50+
use parc::driver::{parse, Config, Flavor};
5151

5252
let config = Config {
5353
cpp_command: "gcc".into(),
@@ -61,7 +61,7 @@ let config = Config {
6161
};
6262

6363
let parsed = parse(&config, "src/input.c")?;
64-
# Ok::<(), pac::driver::Error>(())
64+
# Ok::<(), parc::driver::Error>(())
6565
```
6666

6767
This is the place to inject:
@@ -75,7 +75,7 @@ This is the place to inject:
7575
The convenience constructors also select parser flavor:
7676

7777
```rust
78-
use pac::driver::Config;
78+
use parc::driver::Config;
7979

8080
let gcc = Config::with_gcc(); // gcc -E, GNU flavor
8181
let clang = Config::with_clang(); // clang -E, Clang flavor
@@ -89,7 +89,7 @@ preprocessor.
8989
If you already have `.i`-style content, skip `parse` and call `parse_preprocessed`.
9090

9191
```rust
92-
use pac::driver::{parse_preprocessed, Config};
92+
use parc::driver::{parse_preprocessed, Config};
9393

9494
let source = r#"
9595
# 1 "sample.i"
@@ -100,15 +100,15 @@ count_t next(count_t x) { return x + 1; }
100100

101101
let parsed = parse_preprocessed(&Config::default(), source)?;
102102
println!("{}", parsed.unit.0.len());
103-
# Ok::<(), pac::driver::SyntaxError>(())
103+
# Ok::<(), parc::driver::SyntaxError>(())
104104
```
105105

106106
## Error model
107107

108108
`driver::parse` returns:
109109

110110
```rust
111-
Result<Parse, pac::driver::Error>
111+
Result<Parse, parc::driver::Error>
112112
```
113113

114114
The error variants are:
@@ -127,7 +127,7 @@ The error variants are:
127127
Example:
128128

129129
```rust
130-
use pac::driver::{parse_preprocessed, Config};
130+
use parc::driver::{parse_preprocessed, Config};
131131

132132
let broken = "int main( { return 0; }".to_string();
133133
match parse_preprocessed(&Config::default(), broken) {
@@ -148,13 +148,13 @@ PAC includes a built-in C preprocessor that eliminates the need for an external
148148
`gcc` or `clang` binary. Use `parse_builtin` instead of `parse`:
149149

150150
```rust
151-
use pac::driver::{parse_builtin, Config};
151+
use parc::driver::{parse_builtin, Config};
152152
use std::path::Path;
153153

154154
let config = Config::with_gcc();
155155
let include_paths = vec![Path::new("/usr/include")];
156156
let parsed = parse_builtin(&config, "src/input.c", &include_paths)?;
157-
# Ok::<(), pac::driver::Error>(())
157+
# Ok::<(), parc::driver::Error>(())
158158
```
159159

160160
The built-in preprocessor supports:
@@ -172,14 +172,14 @@ The built-in preprocessor supports:
172172
To extract all `#define` macros from a C file (equivalent to `gcc -dD -E`):
173173

174174
```rust
175-
use pac::driver::capture_macros;
175+
use parc::driver::capture_macros;
176176
use std::path::Path;
177177

178178
let macros = capture_macros("src/input.c", &[Path::new("/usr/include")])?;
179179
for (name, value) in &macros {
180180
println!("#define {} {}", name, value);
181181
}
182-
# Ok::<(), pac::driver::Error>(())
182+
# Ok::<(), parc::driver::Error>(())
183183
```
184184

185185
This returns all macros active after preprocessing, including predefined target

book/src/025_preprocessor.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Built-in Preprocessor
22

3-
PAC includes a complete built-in C preprocessor in the `pac::preprocess` module.
3+
PAC includes a complete built-in C preprocessor in the `parc::preprocess` module.
44
This eliminates the runtime dependency on `gcc` or `clang` for preprocessing.
55

66
## Architecture
@@ -21,7 +21,7 @@ The preprocessor is split into focused modules:
2121
## Quick start
2222

2323
```rust
24-
use pac::preprocess::preprocess;
24+
use parc::preprocess::preprocess;
2525

2626
let output = preprocess("#define X 42\nint a = X;\n");
2727
// output.tokens contains the expanded token stream
@@ -67,7 +67,7 @@ The `#if` expression evaluator supports:
6767
## Include resolution
6868

6969
```rust
70-
use pac::preprocess::{IncludeResolver, Processor};
70+
use parc::preprocess::{IncludeResolver, Processor};
7171

7272
let mut resolver = IncludeResolver::new();
7373
resolver.add_system_path("/usr/include");
@@ -92,7 +92,7 @@ Features:
9292
Target-specific macros are available for common platforms:
9393

9494
```rust
95-
use pac::preprocess::{MacroTable, Target, define_target_macros};
95+
use parc::preprocess::{MacroTable, Target, define_target_macros};
9696

9797
let mut table = MacroTable::new();
9898
define_target_macros(&mut table, &Target::host());

book/src/026_source_ir.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Source IR
22

3-
The `pac::ir` module defines the durable intermediate representation produced
3+
The `parc::ir` module defines the durable intermediate representation produced
44
by the PARC frontend. It is the primary contract between the parser/extractor
55
and downstream consumers (LINC, GERC).
66

77
## Design Principles
88

99
- **Smaller than the AST**: only normalized declarations, not the full syntax tree
1010
- **Serializable**: all types derive `serde::Serialize` and `serde::Deserialize`
11-
- **Parser-agnostic**: downstream consumers should depend on `pac::ir`, not `pac::ast`
11+
- **Parser-agnostic**: downstream consumers should depend on `parc::ir`, not `parc::ast`
1212
- **No link/binary concerns**: no ABI probing, no library paths, no symbol validation
1313

1414
## Key Types
@@ -18,7 +18,7 @@ and downstream consumers (LINC, GERC).
1818
The top-level container:
1919

2020
```rust
21-
use pac::ir::SourcePackage;
21+
use parc::ir::SourcePackage;
2222

2323
let pkg = SourcePackage::new();
2424
assert!(pkg.is_empty());
@@ -68,7 +68,7 @@ Frontend diagnostic with kind, severity, message, optional location, and optiona
6868
All IR types support JSON roundtrip:
6969

7070
```rust
71-
use pac::ir::SourcePackage;
71+
use parc::ir::SourcePackage;
7272

7373
let pkg = SourcePackage::new();
7474
let json = serde_json::to_string_pretty(&pkg).unwrap();

0 commit comments

Comments
 (0)