Commit Graph
969 Commits
Author SHA1 Message Date
Peter Hill 12fcac5e05 Add more recent LFortran linker flag (#7800)
More recent versions of LFortran use `LFORTRAN_LINKER` env var for
linking, rather than `LFORTRAN_CC`.

Tested locally with 0.42 and 0.51
2025-06-17 16:19:40 -05:00
OfekandOfek Shilon d59702383b Fix regression in rustc-nightly opt remarks (#7818)
<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->

Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2025-06-16 21:24:52 +03:00
Ofek daf15af5ab Fix #7809 plus some refactoring (#7812)
Fix #7809 and then some:

Stop processing opt-remarks if none were requested,
Make gcc dump remarks to file,
separate opt-file handling to ClangCompiler and GccCompiler,
make DefaultCompiler inherit GccCompiler,
move some tests around.
2025-06-16 10:13:32 -05:00
narpfel 299d7a251c Fix argument parser for Rust >= 1.88 (#7806)
Resolves #7780.

Basically a follow-up to #7652; the output format of `rustc --help` was
changed to include angle brackets `<` and `>`. This PR updates the
regexes used to parse the help output and adds some tests.
2025-06-16 09:55:02 -05:00
Mats Jun Larsen a3be869e3a Replace PascalUtils class with top-level functions (NFC) (#7610) 2025-06-11 07:11:57 +00:00
Christoffer Lerno 112d000ad2 Fix C3 0.6.8 (#7786) 2025-06-09 18:09:01 -05:00
timo bd80d171de Add raku language and rakudo compiler (#7784)
This relies on https://github.com/compiler-explorer/infra/pull/1658 to
put rakudo release versions in the right spot.


![image](https://github.com/user-attachments/assets/30ba7c2b-389a-4d3f-895b-c13da5b5f072)

There are more things that can be added, such as opcode tooltips,
suggested options for `--target=parse`, `--target=ast`,
`--target=optimize`, and probably other things I haven't thought of yet.
But this pull request should be a good starting point, and fine to merge
without waiting for further features.
2025-06-09 12:39:53 -05:00
Rob Parolin 157662eb31 [mojo-lang] Fixing LLVM IR panel due to calling the mojo compiler with incorrect args. (#7716)
This PR fixes the LLVM IR output for the Mojo compiler integration,
ensuring the LLVM IR panel works correctly and no longer shows "Internal
error; unable to open output path" errors.
2025-05-30 07:48:28 -05:00
Partouf 2e0549b3fb more fixes 2025-05-28 15:21:02 +02:00
Partouf d16d717220 hotfix windows 2025-05-28 14:49:51 +02:00
Partouf de3e34bda8 windows hotfix 2025-05-28 14:00:09 +02:00
Patrick Quist 2e76639163 Windows library support (#7554)
Huray
2025-05-28 10:50:26 +02:00
Patrick Quist 6fb3ab38e7 Add Game Boy emulator support using WasmBoy (#7717) 2025-05-24 18:43:41 +02:00
narpfel 91a2d58aa2 Make 2024 the default edition for Rust >= 1.85 (#7649)
Resolves #7472.
2025-05-23 03:01:26 +02:00
Rob Parolin a0b48fb7e0 Add Mojo compiler (#7692)
This PR adds support for the Mojo programming language.

Explicitly tested viewing the generated assembly, LLVM IR, and running
the generated executable.
2025-05-21 13:53:05 -05:00
Patrick Quist ac4642283c fix pascal execution (#7695)
Fixes #7224
2025-05-20 13:19:31 +02:00
narpfel 703b13ae01 Fix Rust edition argument parser (#7652)
* For `nightly` Rust (and 1.88+), the output format of `--help` was
changed in https://github.com/rust-lang/rust/pull/140152.
This PR changes the parser to parse the new format, so that edition
overrides are selectable for `nightly` Rust. Note the `<>`:
  ```
          --edition <2015|2018|2021|2024|future>
Specify which edition of the compiler to use when
compiling code. The default is 2015 and the latest
                          stable edition is 2024.
  ```
* Rust <= 1.34 (and >= 1.31) support the 2018 edition, but the help
message only includes `--edition` in verbose mode.
2025-05-12 12:54:48 -05:00
Matt GodboltandClaude 2f892583ba Remove global handler_config variable (#7675)
The global handler_config was being used to allow compilers to find
other compilers. This change replaces that global with a proper method
on the CompilationEnvironment class, allowing compilers to find other
compilers through the environment instead of using a global variable.

🤖 PR description generated with [Claude Code](https://claude.ai/code) -
code by @mattgodbolt though :)

Co-authored-by: Claude <noreply@anthropic.com>
2025-05-11 19:47:58 -05:00
Matt Godbolt 9a7e0d4ed8 Fix up import order 2025-05-11 16:15:21 -05:00
Rucadi aa5c02fa70 Add Nix Language (#6198) 2025-05-11 16:07:40 -05:00
Anton Baliasnikov e5c982e7d9 Add solx, new Solidity LLVM-based compiler (#7633) 2025-05-05 13:05:17 +02:00
Patrick Quist afdea17163 fix sway std path and build command (#7597) 2025-04-23 15:53:49 +02:00
narpfel 355d49ec63 [c2rust]: allow passing arguments to clang (#7583)
To pass arguments to `clang` (such as `-std=...`), `--` must be used to
separate these arguments from the arguments to `c2rust`:

```console
$ ./c2rust-transpile --help
transpile 0.20.0
[...]
USAGE:
    c2rust-transpile [OPTIONS] [COMPILE_COMMANDS]... [-- <EXTRA_CLANG_ARGS>...]
```

However, when doing this, the input file must be passed *before* the
`--`. Also, when libraries are enabled, the include and link flags must
be passed to `clang` (but duplicate `--` are not allowed).

Example for passing command line arguments:
https://godbolt.org/z/eqfa3T7WY
Example for activating a library: https://godbolt.org/z/srh55Y1hY
2025-04-22 13:55:17 -05:00
Matt Godbolt 6400235a18 Drop dependency on fs-extra (we removed it a while back) 2025-04-19 13:56:20 -05:00
Tim HuttandMatt Godbolt d1d0883a86 Add support for the Sail language (#7304)
This adds support for the [Sail
language](https://github.com/rems-project/sail) - a DSL for defining
ISAs.

It's not quite ready but I need some help. These are the main remaining
issues:

1. When you "link to binary" it does disassemble the binary properly,
but the syntax highlighting and line numbers are broken.


![image](https://github.com/user-attachments/assets/2f4fe12c-49b4-4b26-9cb0-7e1666a7b3a2)

2. If you try to execute the code without a `function main() -> unit =
...` then it gives this error in the compiler output:

```
Internal Compiler Explorer error: Error: spawn /tmp/compiler-explorer-compiler2025025-31052-c8gern.pf8t/model.c EACCES
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Compiler returned: -1
```

This is weird - it should give a linker with an undefined reference to
`zmain`.

3. Sail compiles to C, and then I added extra steps to compile that to
binary (if you select `Execute the code`), but as you can see I had to
move the binary back over the C file, so in this case `model.c` is
actually an ELF file. It works but that seems very weird. There is a
`getExecutableFilename()` method I could override, but doing that seems
to make it even more confused.

4. I also had to have a fake flag for `binary` because the `filters`
don't seem to get set correctly when passed to `runCompiler()`. E.g.
`buildExecutable()` doesn't pass them at all. Not sure what is going on
there. Seems to work though.

Any help appreciated!

PS: Sail is a cool language. It has lightweight dependent type for
integers and bit vectors, which I haven't demonstrated in the examples
yet, but they're neat.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-04-17 17:22:18 -05:00
Adrien Bertrand 9e7808b13c Add (e)z80-clang compilers. (#7546)
These clang + LLVM backends are not upstreamed but [a community
effort](https://github.com/CE-Programming/llvm-project/), so it's a bit
customized.

This requires https://github.com/compiler-explorer/infra/pull/1566

_Edit: tested locally, works fine._
2025-04-14 15:17:39 -05:00
Ofek 36715c9369 Support opt remarks for rustc-nightly (#7561)
Closes #7525.
2025-04-12 11:29:38 +03:00
Mats Jun Larsen 1e4f0cbb49 Revert noThisInStatic Biome rule for argument-parsers.ts (#7529) 2025-03-29 15:33:40 +01:00
Steve 948382018e .NET: Add multiple architectures support for NativeAOT (#7496)
Depends on https://github.com/compiler-explorer/dotnet-builder/pull/25
2025-03-27 13:52:41 -05:00
Matt Godbolt 90aee8f04d Implement a no-op parser for handling rust 2025-03-27 12:15:39 -05:00
Nicole LeGare 73196b9441 Turns out getOutputFilename was necessary 2025-03-18 13:46:24 -07:00
Nicole LeGare d0c91b07f8 Remove unnecessary function overrides 2025-03-18 13:46:24 -07:00
Nicole LeGare e74adc5c28 Remove unnecessary comment 2025-03-18 13:46:24 -07:00
Nicole LeGare 800a015c49 Invoke main c2rust binary instead of c2rust-transpile
This gives us the correct version string, rather than getting the version for just the c2rust-transpile binary.
2025-03-18 13:46:24 -07:00
Nicole LeGare 8f56587bae Add support for c2rust as a C compiler 2025-03-18 13:46:24 -07:00
kevinjeon-g 3ea4baa363 Correctly handle missing .dex file for R8 (#7498)
R8 will not produce a .dex file if there are no entry points into the
.class file code. This change updates R8/D8 so that a missing .dex file
returns a message to the user in the compiler output window, instead of
logging a warning/error.
2025-03-15 00:31:18 +00:00
Joshua BattyandMatt Godbolt 8c6ce602d1 Add support for pre-installed Sway std library (#7456)
This PR updates the Sway compiler to use pre-installed std libraries
rather than fetching from GitHub. It:

Dynamically adds the std library path to `Forc.toml` when using
versioned compilers
Sets the `--offline` flag at the group level to prevent network access
Works with the std library package added in compiler-explorer/infra#1539

This resolves the issue where Sway was attempting to fetch libraries
from the internet, which is blocked in the Compiler Explorer
environment. see [this
comment](https://github.com/compiler-explorer/compiler-explorer/pull/7409#issuecomment-2679284531)

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-03-10 12:58:07 -05:00
Marc Auberer bae3b714ee [Spice] Short cli flag -obj was removed (#7467)
The short flag `-obj` was removed from the compiler cli.
The long version (`--dump-object-file`) was already available before and
thus also works for older compiler versions.
2025-02-28 23:48:04 +01:00
Matt Godbolt a66cf13ff5 Improvements to r8/d8 dex stuff (#7460)
- better handling of missing files (doesn't crash)
- better error reporting.
2025-02-26 14:09:24 -06:00
Matt Godbolt 86536fc8bc Port compilers over to using node:fs et al (#7449)
- use utils functions where necessary
- introduce a few asyncs where needed.

Some local testing done (e.g. with sway and clang). Will need testing in
staging for the best outcome.
2025-02-26 10:56:10 -06:00
Ofek 64706f1d53 Fix #7265: Check explicitly for clangir instead of '-emit-cir' support 2025-02-26 02:07:48 +02:00
Ofek e01aa3e691 Various type improvements 2025-02-26 02:07:09 +02:00
Matt Godbolt 698f9944cd Use node:fs/promises where possible (#7444)
- Updates a number of uses of `fs-extra` which were only for the
promisified fs calls.
- Makes a few sync calls async.
- Makes a few `read` calls that didn't specify a text mode, but then
parsed as a string...into the equivalent `readFile` call.
2025-02-25 13:26:31 -06:00
Matt Godbolt 792e55f31e Fix format of processAsm (#7431)
I'll update `processAsm` to actually have a proper type and that will
catch this in future.
2025-02-24 12:33:51 -06:00
8557b59055 added initial support for the Coccinelle code transformation system, closes #6999 (#7001)
This fork provides a rudimentary way of using Coccinelle within Compiler
Explorer.
In the left window one can edit either C or C++ code, and within
preprocessor ifdefs, one can write a semantic patch for Coccinelle.
The right window will display the transformed code.

A coccinelle on infra is not yet done.
Any distribution-based coccinelle would do, for the moment.

If you like it, this close #6999 .

---------

Signed-off-by: Michele Martone <michelemartone@users.sourceforge.net>
Co-authored-by: Patrick Quist <partouf@gmail.com>
Co-authored-by: Mats Jun Larsen <mats@jun.codes>
Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-02-24 10:10:35 -06:00
Joshua BattyandMatt Godbolt b272efdb53 Add sway compiler (#7409)
Should be pretty self explanatory. I've added a corresponding PR to the
infra repo [here](https://github.com/compiler-explorer/infra/pull/1532)

Please let me know if there is anything I've done incorrectly here!
Thanks

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-02-24 09:38:13 -06:00
kevinjeon-g a142ae29b7 Add version info for R8/D8 (#7406)
This fixes the version info button in the compiler window for R8/D8.
Version info is pulled from the version properties file for latest, and
from the filename for named releases.
2025-02-19 10:42:21 -06:00
Rupert TombsandMats Jun Larsen ca1ecbb2e3 Add Numba (#5592)
- Add initial support for Numba compilation: asm, demangling, execution

Numba wraps Python functions in `Dispatcher` objects. Each dispatcher
contains zero or more compiled argument-type-indexed overloads of its
function. We import the user's code as a module, and emit the code from
all overloads of all dispatchers that the module publicly exposes.

Name mangling is odd in Numba. It uses a similar mangling syntax to C++,
but also encodes non-symbol (`r"[^a-z0-9_]"`) characters as `_%02x`.
This encoding yields valid identifier names, so it is not strictly
invertible. Here, I have hard-coded some replacements to decode some
common cases at the cost of possible clashes with ugly user-defined
names.

Screenshot captured via `make dev EXTRA_ARGS="--debug --language numba"`

![generator
example](https://github.com/user-attachments/assets/77b8e53a-3589-4e0d-9589-10c36a026b6f)


## To do

- [x] Answer questions of #5591.
- [x] Acquire a python environment.
- [ ] Automatically run the python test?

Locally, I have installed a virtual environment with python 3.12.3 with

```shell
path/to/python -m venv venv_numba
path/to/venv_numba/bin/python -m pip install numba==0.61.0 scipy>=0.16
```

and configured its use with

```properties
# compiler-explorer/etc/config/numba.local.properties
compilers=&numba
defaultCompiler=numba_0_61_0

group.numba.compilers=numba_0_61_0
group.numba.baseName=Numba

compiler.numba_0_61_0.exe=/path/to/python3.13
compiler.numba_0_61_0.semver=0.61.0
```

I run this python-side test file with

```python
path/to/venv_numba/bin/python -m unittest etc/scripts/test_numba_wrapper.py
```

---------

Co-authored-by: Mats Jun Larsen <mats@jun.codes>
2025-02-19 10:41:42 -06:00
Stephen Heumann 0695a0fe20 Disable external parser for ORCA/C (#7407)
ORCA/C uses its own asm format, and the external parser is not
appropriate for it.
2025-02-18 17:23:17 -06:00
Stephen HeumannandMatt Godbolt 5a72fa0659 Add support for ORCA/C (#7368)
[ORCA/C](https://github.com/byteworksinc/ORCA-C) is a C compiler that
natively runs on and targets the Apple IIGS. ORCA/C and the programs it
generates can be run on modern Linux systems by using an emulation tool
called [Golden Gate](https://goldengate.gitlab.io).

This adds support for ORCA/C (run via Golden Gate) in Compiler Explorer.
It uses its own assembly format and objdumper (provided by Golden Gate),
so support for those is added. An extra configuration option was also
added to support execution via an emulator, bypassing the usual check
that executables can run natively. Asm docs for the WDC 65C816 processor
were also added.

ORCA/C and Golden Gate are not Free Software, but their rights holders
have given permission for them to be used on Compiler Explorer. Tarballs
for them can be supplied privately. See infra PR:
compiler-explorer/infra#1521

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2025-02-18 10:28:10 -06:00