Skip to content

feat: add --standard-json I/O mode to edgec#33

Merged
refcell merged 4 commits into
mainfrom
feat/standard-json-io
Mar 8, 2026
Merged

feat: add --standard-json I/O mode to edgec#33
refcell merged 4 commits into
mainfrom
feat/standard-json-io

Conversation

@refcell
Copy link
Copy Markdown
Owner

@refcell refcell commented Mar 8, 2026

This implements issue #27. The edgec standard-json subcommand now implements the Foundry/solc standard JSON IPC protocol, making edgec a drop-in compiler backend for foundry-compilers.

The subcommand reads a JSON compilation request from stdin, compiles each source file listed in the sources map, and writes a JSON response to stdout. The response follows solc's standard JSON output schema with a top-level contracts map keyed by source path and contract name, each entry containing the ABI as a JSON array and the EVM bytecode as a raw hex string without a 0x prefix. All errors — parse failures, type errors, codegen failures — are encoded as structured objects in the errors array rather than signaled through the exit code, which always stays 0.

The implementation lives in a new crates/driver/src/standard_json.rs module that defines StandardJsonInput, StandardJsonOutput, and the compile_standard_json function. This function iterates over the input sources, calls Compiler::from_source for each, and assembles the output. As a side fix, the full bytecode path in compiler.rs was corrected to populate abi on CompileOutput — previously it was always None outside of --emit abi mode.

Four integration tests in crates/driver/tests/standard_json.rs cover successful compilation of counter.edge, structured error output on invalid source, JSON schema correctness, and the no-0x-prefix invariant on bytecode output. All workspace tests pass.

Closes #27.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 8, 2026

Deploy Preview for edgelang ready!

Name Link
🔨 Latest commit a932a24
🔍 Latest deploy log https://app.netlify.com/projects/edgelang/deploys/69acdb2c3ce98000088b8d96
😎 Deploy Preview https://deploy-preview-33--edgelang.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@refcell refcell merged commit d387323 into main Mar 8, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add --standard-json I/O mode to edgec

1 participant