All Projects → Rust-GCC → Gccrs

Rust-GCC / Gccrs

Licence: other
GCC Front-End for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to Gccrs

Ccache
ccache – a fast compiler cache
Stars: ✭ 1,128 (+28.91%)
Mutual labels:  compiler, gcc
Ghdl
VHDL 2008/93/87 simulator
Stars: ✭ 1,285 (+46.86%)
Mutual labels:  compiler, gcc
C
Compile and execute C "scripts" in one go!
Stars: ✭ 1,920 (+119.43%)
Mutual labels:  compiler, gcc
Open C Book
开源书籍:《C语言编程透视》,配套视频课程《360° 剖析 Linux ELF》已上线,视频讲解更为系统和深入,欢迎订阅:https://www.cctalk.com/m/group/88089283
Stars: ✭ 715 (-18.29%)
Mutual labels:  compiler
Bic
A C interpreter and API explorer.
Stars: ✭ 719 (-17.83%)
Mutual labels:  compiler
Numba
NumPy aware dynamic Python compiler using LLVM
Stars: ✭ 7,090 (+710.29%)
Mutual labels:  compiler
Grin
GRIN is a compiler back-end for lazy and strict functional languages with whole program optimization support.
Stars: ✭ 834 (-4.69%)
Mutual labels:  compiler
Inc
an incremental approach to compiler construction
Stars: ✭ 702 (-19.77%)
Mutual labels:  compiler
Rustc Dev Guide
A guide to how rustc works and how to contribute to it.
Stars: ✭ 789 (-9.83%)
Mutual labels:  compiler
J2cl
Java to Closure JavaScript transpiler
Stars: ✭ 773 (-11.66%)
Mutual labels:  compiler
Pyret Lang
The Pyret language.
Stars: ✭ 771 (-11.89%)
Mutual labels:  compiler
Tl
The compiler for Teal, a typed dialect of Lua
Stars: ✭ 716 (-18.17%)
Mutual labels:  compiler
Compiler
Compiler for Elm, a functional language for reliable webapps.
Stars: ✭ 6,672 (+662.51%)
Mutual labels:  compiler
Ring
Innovative and practical general-purpose multi-paradigm language
Stars: ✭ 716 (-18.17%)
Mutual labels:  compiler
Tvm
Open deep learning compiler stack for cpu, gpu and specialized accelerators
Stars: ✭ 7,494 (+756.46%)
Mutual labels:  compiler
Csharp.lua
The C# to Lua compiler
Stars: ✭ 712 (-18.63%)
Mutual labels:  compiler
Typescripttolua
Typescript to lua transpiler. https://typescripttolua.github.io/
Stars: ✭ 783 (-10.51%)
Mutual labels:  compiler
Caramel
🍬 a functional language for building type-safe, scalable, and maintainable applications
Stars: ✭ 756 (-13.6%)
Mutual labels:  compiler
Vtil Core
Virtual-machine Translation Intermediate Language
Stars: ✭ 738 (-15.66%)
Mutual labels:  compiler
Elm Platform
Bundle of all core development tools for Elm
Stars: ✭ 775 (-11.43%)
Mutual labels:  compiler

C/C++ CI Docker Build Docker Pulls project chat

GCC Rust

GCC Rust

Please note, the compiler is in a very early stage and not usable yet for compiling real Rust programs.

gccrs is a full alternative implementation of the Rust language ontop of GCC with the goal to become fully upstream with the GNU toolchain.

The origin of this project was a community effort several years ago where Rust was still at version 0.9; the language was subject to so much change that it became difficult for a community effort to play catch up. Now that the language is stable, it is an excellent time to create alternative compilers. The developers of the project are keen “Rustaceans” with a desire to give back to the Rust community and to learn what GCC is capable of when it comes to a modern language.

FAQ

Please find the answers to frequently asked questions over on: https://github.com/Rust-GCC/gccrs/wiki/Frequently-Asked-Questions

Development Environment

Fetch dependencies for Ubuntu:

$ apt install build-essential libgmp3-dev libmpfr-dev libmpc-dev flex bison autogen gcc-multilib dejagnu

Clone the repository

$ git clone [email protected]:Rust-GCC/gccrs.git

Compilation script. It is important to remember that GNU toolchain projects are designed to be built outside of their source directory which is why a build directory is created.

$ mkdir gccrs-build
$ cd gccrs-build
$ ../gccrs/configure --prefix=$HOME/gccrs-install --disable-bootstrap --enable-multilib --enable-languages=rust
$ make

Running the compiler itself without make install we can simply invoke the compiler proper:

$ gdb --args ./gcc/rust1 test.rs -frust-dump-parse -Warray-bounds -dumpbase test.rs -mtune=generic -march=x86-64 -O0 -version -fdump-tree-gimple -o test.s -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib64

To invoke the compiler driver (gccrs) we need to:

$ make install

Then invoke the compiler as expected:

$ gccrs -g -O2 -c test.rs -o test.o
$ gccrs -o test test.o

Testsuite

Invoke the test suite via:

$ make check-rust

Test cases are located within gcc/testsuite/rust.test please feel free to contribute your specific test cases referencing any issues on Github.

Docker image

There is a docker image hosted over on:

https://hub.docker.com/repository/docker/philberty/gccrs

$ docker pull philberty/gccrs

Or you can build your own image:

$ docker build . -t gccrs-dev

If you want to build an object file:

$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp \
    gccrs-dev:latest gccrs -g -O2 -c \
    gcc/testsuite/rust.test/compilable/type_infer1.rs -o type_infer1.o

If you want to build an executable file:

$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp \
    gccrs-dev:latest gccrs -g -O2 \
    gcc/testsuite/rust.test/compilable/type_infer1.rs -o type_infer1

To emit assembly :

$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp \
    gccrs-dev:latest gccrs -g -O2 \
    gcc/testsuite/rust.test/compilable/type_infer1.rs -S -o type_infer1.s 

To emit the debug outputs you can add the option -frust-dump-all :

$ docker run --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp \
    gccrs-dev:latest gccrs -g -O2 \
    gcc/testsuite/rust.test/compilable/type_infer1.rs -o type_infer1 -frust-dump-all

Contributing

Please be aware this project is designed to be pushed upstream to GCC when we reach some milestones, and this means we require contributions to have copyright assignment in place. Please see https://gcc.gnu.org/contribute.html.

Not all contributions must be code; we would love to see new test cases or bugs and issues to be reported. Feel free to add any comments on open PRs

Community

We can be found on all usual Rust channels such as Zulip, but we also have our own channels:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].