You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/driver/README.md
+15-1Lines changed: 15 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# edge-driver
2
2
3
-
Compiler driver that orchestrates the full Edge compilation pipeline. Reads source files and runs each phase in sequence: lex, parse, type-check, lower to IR, and emit EVM bytecode.
3
+
Compiler driver that orchestrates the full Edge compilation pipeline. Reads source files and runs each phase in sequence: lex, parse, type-check, lower to IR, and emit EVM bytecode. The `standard_json` module provides a Solidity-compatible standard JSON I/O interface so that build tools like Foundry can drive `edgec` with a single JSON blob on stdin.
-**`EmitKind`** -- What the compiler should produce: `Tokens`, `Ast`, `Abi`, or `Bytecode`
27
27
-**`Session`** -- Per-compilation state: config, source text, and accumulated diagnostics
28
+
-**`StandardJsonInput`** -- Deserialized standard JSON request (sources, settings)
29
+
-**`StandardJsonOutput`** -- Serialized standard JSON response (contracts, errors)
30
+
-**`compile_standard_json`** -- Compiles all sources from a `StandardJsonInput` and returns a `StandardJsonOutput`
28
31
29
32
## Usage
30
33
@@ -45,6 +48,17 @@ if let Some(abi) = &output.abi {
45
48
}
46
49
```
47
50
51
+
The `compile_standard_json` function accepts a `StandardJsonInput` and returns a `StandardJsonOutput` containing ABI and bytecode for every contract in the input. Errors are reported inside the output rather than as Rust-level failures.
52
+
53
+
```rust,no_run
54
+
use edge_driver::standard_json::{compile_standard_json, StandardJsonInput};
55
+
56
+
let json_str = r#"{"language":"Edge","sources":{"counter.edge":{"content":"..."}}}"#;
57
+
let input: StandardJsonInput = serde_json::from_str(json_str).unwrap();
0 commit comments