@@ -10,44 +10,61 @@ This page gives you the fastest path from a fresh checkout to compiling an
1010
1111## Install
1212
13- Install the Edge toolchain with ` edgeup ` :
13+ Install ` edgeup ` , the Edge toolchain manager :
1414
15- ``` sh
15+ ``` bash
1616curl -fsSL https://raw.githubusercontent.com/refcell/edge-rs/main/etc/install.sh | sh
1717```
1818
19- Or build the compiler from source :
19+ Then install the Edge compiler :
2020
21- ``` sh
22- cargo install --path bin/edgec
21+ ``` bash
22+ edgeup install
2323```
2424
25- ## Compile a Contract
25+ ` edgeup ` detects your shell (bash, zsh, or fish) and appends the toolchain
26+ directory to your ` PATH ` automatically. Restart your shell or run the printed
27+ ` source ` command before continuing.
28+
29+ ** Supported platforms:** Linux x86_64, macOS x86_64, macOS arm64 (Apple
30+ Silicon). Windows is not supported.
31+
32+ ## Compile a contract
2633
2734Pass a source file directly to ` edgec ` to compile it. By default, the compiler
2835prints EVM bytecode as a hex string to stdout.
2936
30- ``` sh
37+ ``` bash
3138edgec examples/counter.edge
3239edgec examples/counter.edge -o counter.bin
3340edgec -v examples/expressions.edge
3441```
3542
36- ## Inspect Intermediate Stages
43+ ## Inspect intermediate stages
44+
45+ The compiler can stop after earlier phases of the pipeline using subcommands
46+ or the ` --emit ` flag:
3747
38- The compiler can also stop after earlier phases of the pipeline:
48+ ``` bash
49+ # Subcommands
50+ edgec lex examples/counter.edge # print tokens
51+ edgec parse examples/counter.edge # print AST
52+ edgec check examples/counter.edge # type-check only, no output
3953
40- ``` sh
41- edgec lex examples/counter.edge
42- edgec parse examples/counter.edge
43- edgec check examples/counter.edge
54+ # --emit flag variants
55+ edgec --emit tokens examples/counter.edge # lex only
56+ edgec --emit ast examples/counter.edge # parse only
57+ edgec --emit ir examples/counter.edge # IR (s-expression)
58+ edgec --emit pretty-ir examples/counter.edge # IR (pretty-printed)
59+ edgec --emit asm examples/counter.edge # pre-final assembly
60+ edgec --emit bytecode examples/counter.edge # EVM bytecode (default)
4461```
4562
46- ## ABI Output
63+ ## ABI output
4764
4865Passing ` --emit abi ` prints the contract ABI as JSON to stdout, compatible with the Ethereum ABI specification. This is useful for generating interface files consumed by frontends, deployment scripts, and other tooling.
4966
50- ``` sh
67+ ``` bash
5168edgec --emit abi examples/counter.edge
5269# [{"type":"function","name":"increment","inputs":[],"outputs":[],"stateMutability":"view"}, ...]
5370```
@@ -56,12 +73,48 @@ edgec --emit abi examples/counter.edge
5673
5774The ` edgec standard-json ` command implements the standard JSON IPC protocol used by Foundry and solc-compatible toolchains. It reads a JSON request from stdin containing source files and compiler settings, compiles every source, and writes a JSON response to stdout with ABI and bytecode fields for each contract. The command always exits 0; compilation errors are reported inside the JSON response rather than as a non-zero exit code. This is the interface that the ` foundry-compilers ` crate uses to drive external compilers.
5875
59- ``` sh
76+ ``` bash
6077echo ' {"language":"Edge","sources":{"counter.edge":{"content":"..."}}}' | edgec standard-json
6178# {"sources":{"counter.edge":{"id":0}},"contracts":{"counter.edge":{"Counter":{"abi":[...],"evm":{"bytecode":{"object":"604d..."},...}}}}}
6279```
6380
64- ## Explore the Reference Programs
81+ ## Optimization flags
82+
83+ Control the optimization level and target metric:
84+
85+ ``` bash
86+ edgec -O2 examples/counter.edge # optimization level 0–3 (default: 0)
87+ edgec --optimize-for size examples/counter.edge # optimize for bytecode size
88+ edgec --optimize-for gas examples/counter.edge # optimize for gas cost (default)
89+ ```
90+
91+ ## Standard library path
92+
93+ The compiler embeds the Edge standard library at build time. To use a local
94+ checkout of the stdlib instead, set ` --std-path ` or the ` EDGE_STD_PATH `
95+ environment variable:
96+
97+ ``` bash
98+ edgec --std-path ./std examples/counter.edge
99+ EDGE_STD_PATH=./std edgec examples/counter.edge
100+ ```
101+
102+ ## Language server
103+
104+ Edge ships an LSP server for editor integration. Start it with:
105+
106+ ``` bash
107+ edgec lsp
108+ ```
109+
110+ The server communicates over stdin/stdout and provides parse and type-check
111+ diagnostics with precise source spans.
112+
113+ ::: warning
114+ Hover, completions, and go-to-definition are not yet implemented.
115+ :::
116+
117+ ## Explore the reference programs
65118
66119The repository includes a growing set of example contracts under
67120[ ` examples/ ` ] ( https://github.com/refcell/edge-rs/tree/main/examples ) , ranging
0 commit comments