Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fedejinich/fcc
A compiler for a tiny subset of C, written in Rust.
https://github.com/fedejinich/fcc
Last synced: 11 days ago
JSON representation
A compiler for a tiny subset of C, written in Rust.
- Host: GitHub
- URL: https://github.com/fedejinich/fcc
- Owner: fedejinich
- Created: 2022-04-01T16:01:09.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-05T16:48:17.000Z (over 2 years ago)
- Last Synced: 2023-03-09T22:26:44.745Z (almost 2 years ago)
- Language: Rust
- Size: 101 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fcc (another C compiler)
A compiler for a tiny C subset, written in Rust. Inspired by [Nora Sandler's book](https://norasandler.com/2022/03/29/Write-a-C-Compiler-the-Book.html).
Requirements
- ONLY targets `x86_64` architectures.
- `gcc`: used for linking the assembly files.## Clone
```bash
git clone https://github.com/fedejinich/fcc.git --recurse-submodules
```## Build
Build `fcc` cargo project and output and executable to `~/target/debug`.
```bash
cargo build
```## Compile With fcc
Compile .c files with `fcc` compiler.
```bash
./fcc
```## Run Integration Tests
You can run the integration test suite from [Nora's repo](https://github.com/nlsandler/write_a_c_compiler) by going to `~/fcc/tests/resources/wirte_a_c_compiler` and running:
```
./test_compiler.sh /path/to/fcc
```#### Test specific stages
To test stage 1 and stage 3,
```bash
./test_compiler.sh /path/to/your/compiler 1 3
```To test from stage 1 to stage 6,
```bash
./test_compiler.sh /path/to/your/compiler `seq 1 6`
```