Details:
LFortran is a modern open-source (BSD licensed) interactive Fortran
compiler built on top of LLVM. See, https://lfortran.org for more
details.
There was an interest in the community to add the compiler into the
Compiler Explorer: https://github.com/lfortran/lfortran/issues/623.
So, this PR adds it.
LFortran is in alpha (the source code compiles to binary and execute.
But, users are expected that their code can break). It can emits AST,
ASR, LLVM, C, C++, WAT, Julia, Fortran, etc. It has multiple backend
like LLVM (default), C, C++, x86, WASM, fortran and mlir.
For more options run `--help`.
Changes in this PR:
- Add LFortran as a new Fortran compiler.
- `-g` options is enabled by default in `optionsForFilter`. Providing an
option
to disabling it helps other compilers (that doesn't have complete
support for
debug information) to compile successfully
Hello! I'm a big fan of Godbolt and use it regularly to test gas
optimizations in Solidity. However, to this day, there is no support for
Vyper, the second most popular language targeting the EVM, related issue
#4165. We at Statemind.io thought that adding Vyper support would
greatly benefit developers and security researchers, so here is our
attempt to get it working :)
This PR **is not ready** for merging, as `vyper.defaults.properties` and
`vyper.amazon.properties` are not yet defined. I have a few questions to
clarify how to integrate it on the public instance and infrastructure
repository:
Because Vyper compiler is basically a python module, I've found success
in testing multiple versions via separate `venv` environments. In my
local tests `vyper.local.properties` was the following:
```INI
compilers=vyper
compilerType=vyper
versionFlag=--version
compiler.vyper.exe=/opt/research/godbolt/venv/bin/vyper
compiler.vyper.isSemVer=true
compiler.vyper.instructionSet=evm
compiler.vyper.options=--optimize none
```
The versions tested are the latest major Vyper release 0.4.0, along with
0.3.10 and earlier 0.3.xx releases.
It appears that there is support for running python in a virtual
environment in the infra repository:
https://github.com/compiler-explorer/infra/blob/main/bin/lib/installable/python.py
However, I've had difficulties getting started with it and would greatly
appreciate any assistance. Thank you!
- Adding support for .NET 9.0
- Adding support for ILSpy
- Make some changes to the compiler name so that the meaning of the
version is more cleared
- Adding missing compilers for existing .NET versions
cc: @mattgodbolt
for https://github.com/compiler-explorer/compiler-explorer/issues/2331
Hey, so I am currently trying to improve the SPIR-V ecosystem, in-charge
of the [SPIR-V Guide](https://github.com/KhronosGroup/SPIRV-Guide), and
part of the SPIR-V Working Group. We talked at our last Face-2-Face
gathering about getting more support for GPU tooling in something like
Compiler Explorer because you have all made this such an amazing tool!
I have enjoyed working in this codebase and happy to help keep improving
the SPIR-V as people find issues or want enhancements (I was already
about to spend time rebuilding Compiler Explorer, so happy to donate my
time to a single tool's effort)
(For those who haven't spent last few years staring at SPIR-V)
- SPIR-V is a an IR (very much like LLVM IR) but for GPUs
- SPIR-V can be used for Graphics and Compute
- Compute:
- Can be tied to things like clang, llvm, mlir, OpenCL, etc
- One could take `spirv` as a language and compile it to something like
x86
- (Future PRs for this realm of things)
- Graphics:
- Much harder to actually "compile" to any ISA because other graphics
pipeline information is missing that will effect the final ISA
- Microsoft has even now planned to move to [SPIR-V for DirectX
soon](https://devblogs.microsoft.com/directx/directx-adopting-spir-v/)
- Both:
- There are many tools that run on SPIR-V regardless (hence why they
share the same IR)
- Being able to do tooling in compiler explorer would be AMAZING
This PR adds `SPIR-V` as a language and a new `SPIRV-Tools` compiler as
an initial compiler for it the language (since we already have the
SPIRV-Tools repo being pulled in on the infra side!)
I personally use `spirv-opt` and `spirv-val` the most and have been
testing this locally for a few days and feel it is ready to go. I plan
to slowly add more tools (ex. `spirv-fuzz`, `spirv-cross`,
`spirv-reflect`, etc)
Cheers!
(some screenshots of course)


Hi dear godbolt team,
> Before opening the PR, please make sure that the tests & linter pass
their checks,
> by running `make check`.
With this pr i added support for the ylc compiler.
Infra-PR: https://github.com/compiler-explorer/infra/pull/1441
Supersedes #6842
- We now have the upstream issue of `JitDisasmAssemblies` fixed. Enable
it for net9.0+.
- Update asm-parser to support CoreCLR and NativeAOT (Fixes#6833)
- Adding support for IL language
- Adding support for IL disassembler
- Fixes#6629
Adding support for mono and NativeAOT.
As for NativeAOT, we have some upstream issues need to be resolved
before we can use `JitDisasmAssemblies` to print disasm for the
specified assembly only, where it would fail with:
```
Unhandled exception: ILCompiler.CodeGenerationFailedException: Code generation failed for method '[S.P.CoreLib]<Module>..cctor()'
---> System.NotImplementedException: getClassModule
at Internal.JitInterface.CorInfoImpl.getClassModule(CORINFO_CLASS_STRUCT_*) + 0x2b
at Internal.JitInterface.CorInfoImpl._getClassModule(IntPtr, IntPtr*, CORINFO_CLASS_STRUCT_*) + 0x39
--- End of inner exception stack trace ---
at Internal.JitInterface.CorInfoImpl.CompileMethodInternal(IMethodNode, MethodIL) + 0x273
at Internal.JitInterface.CorInfoImpl.CompileMethod(MethodCodeNode, MethodIL) + 0x63
at ILCompiler.RyuJitCompilation.CompileSingleMethod(CorInfoImpl, MethodCodeNode) + 0x97
at ILCompiler.RyuJitCompilation.CompileSingleThreaded(List`1) + 0xee
at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1) + 0x173
at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes() + 0x159
at ILCompiler.RyuJitCompilation.CompileInternal(String, ObjectDumper) + 0x26
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x5d
at ILCompiler.Program.Run() + 0x2a55
at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass240_0.<.ctor>b__0(ParseResult) + 0x321
at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult) + 0x6f
```
For now, workaround with removing `JitDisasmAssemblies` and print disasm
for all assemblies instead. (see the second commit)
/cc: @MichalStrehovsky We need to implement `getClassModule`,
`getModuleAssembly` and `getAssemblyName` in ilc to make
`JitDisasmAssemblies` work correctly.
Closes#5668
R8 is a whole-program optimizer that converts Java byte code to
optimized dex code. It can be run with the same general steps (and JAR)
as the existing D8 compiler.
This change adds R8Compiler and the R8 keep-annotation library it relies
on, makes this lib + Android API stubs default libraries for Android
Java/Kotlin, and includes a small update to allow older versions of
dex2oat (33.10) to run.
https://r8.googlesource.com/r8
Depends on https://github.com/compiler-explorer/infra/pull/1312.
I'm considering to unify all old compiler versions per dotnet minor
version as patch upgrade in dotnet doesn't change the codegen. New patch
versions come with quality updates like bug and security fixes, we only
need the latest version per minor dotnet version instead. Here a version
is consisting of `major.minor.patch`, such as `7.0.3` and `8.0.5`.
i.e.
- `dotnet6030csharp:dotnet6018csharp:dotnet6014csharp:dotnet6011csharp`
-> `dotnet60csharp`, and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`,
`6.0.14` and `6.0.11` are all `6.0`
- `dotnet6030fsharp:dotnet6018fsharp:dotnet6014fsharp:dotnet6011fsharp`
-> `dotnet60fsharp`, and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`,
`6.0.14` and `6.0.11` are all `6.0`
- `dotnet6030vb:dotnet6018vb:dotnet6014vb:dotnet6011vb` -> `dotnet60vb`,
and rename it to `.NET 6.0`, as `6.0.30`, `6.0.18`, `6.0.14` and
`6.0.11` are all `6.0`
- `dotnet7019csharp:dotnet707csharp:dotnet703csharp:dotnet701csharp` ->
`dotnet70csharp`, and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`,
`7.0.3` and `7.0.1` are all `7.0`
- `dotnet7019fsharp:dotnet707fsharp:dotnet703fsharp:dotnet701fsharp` ->
`dotnet70fsharp`, and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`,
`7.0.3` and `7.0.1` are all `7.0`
- `dotnet7019vb:dotnet707vb:dotnet703vb:dotnet701vb` -> `dotnet70vb`,
and rename it to `.NET 7.0`, as `7.0.19`, `7.0.7`, `7.0.3` and `7.0.1`
are all `7.0`
I'm keeping the minor version (ie. `.0`) in the name as there may be
updates like `.NET Core 3.1` to `.NET Core 3.0` which does change the
codegen.
The compiler structure now is:
```
group: dotnetcoreclr
.NET (main)
.NET 8
.NET 7
group: dotnetcrossgen2
.NET (main)
.NET 8
.NET 7
.NET 6
group: dotnetlegacy
existing compilers for backward compact
```
---------
Co-authored-by: Patrick Quist <partouf@gmail.com>
Pythran is a python to c++ transpiler.
Our supports both the C++ and the full link to a share library (a python
module).
See https://pypi.org/project/pythran/ for more information.
fixes#6079
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
Add support for the Spice programming language.
Spice (`spicelang`) is a simple, AOT compiled, LLVM-based systems
language with focus on practicality and performance.
**Key features of Spice**
- simplicity - see what you get aproach with batteries included
- performance: As Spice uses LLVM as its primary backbone, it competes
with the performance of other LLVM-based compilers
- enhanced safety: Spice implements an enhanced safety mechanism, which
includes builtin heap type with auto-free and more
- cross-compile support: Currently x86_64, AArch64 and wasm32 are
supported cross-compilation targets, but more to come
- Pretty good C and C++ interop
**Links**
- Source code: https://github.com/spicelang/spice
- Website: https://spicelang.com
- Playground (own CE instance): https://play.spicelang.com
- Infra PR: https://github.com/compiler-explorer/infra/pull/1229
**Things this PR addresses**
- General support for Spice
- Three code examples
- Spice mode (Syntax highlighting)
- Opt pipeline support
- LLVM mca and osaca support
Adds Dex2OatCompiler, which applies to the Android Java and Android
Kotlin languages. Dex2OatCompiler runs on .dex files output by
D8Compiler, which in turn runs on .class files output by JavaCompiler or
KotlinCompiler. A parser has been added for dex2oat optimization passes.
# Cerberus
[Cerberus](https://www.cl.cam.ac.uk/~pes20/cerberus/) offers executable
semantics for a substantial fragment of C and
CHERI-C languages. It is implemented via an elaboration into a simpler
Core language, which is displayed as the compiler
output in the Compiler Explorer. Evaluation of C programs (execution) is
also supported.
## Prerequisites
The easiest way to install both the Cerberus and Cerberus-CHERI
compilers is by using Docker:
`docker pull vzaliva/cerberus-cheri`
Then, for example, you can print the _Core_ elaboration for `test.c`
using ISO C semantics:
`docker run -v $HOME/tmp:/mnt -it vzaliva/cerberus-cheri cerberus
--pp=core --exec /mnt/test.c`
## Configuration
The file `etc/config/c.defaults.properties` defines a group of two
compilers: 'cerberus' for ISO C and 'cerberus-cheri'
for CHERI-C. It assumes that the corresponding executables are in the
path.
## Limitations and Future Improvement
Presently, only simple Core output is shown. It is not syntactically
highlighted nor linked to C source code locations.
Some potential future improvements include:
1. Error location handling in warning and error messages
2. Specifying execution flags
3. Core syntax highlighting
4. Display of AST
5. Display of other intermediate languages (Cabs, Ail)
6. Tooltips/links to the ISO C document from Core annotations
## See also:
- [Cerberus (project page)](https://www.cl.cam.ac.uk/~pes20/cerberus/)
- [Cerberus (GitHub
repository)](https://github.com/rems-project/cerberus)
- ["Formal Mechanised Semantics of CHERI C: Capabilities, Undefined
Behaviour, and Provenance" (paper,
preprint)](https://zaliva.org/cheric-asplos24.pdf)
- ["CHERI C semantics as an extension of the ISO C17 standard" (tech
report)](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-988.html)
Fixes#5502
In this PR I make an early attempt to add the CMakeScript as a language
in compiler-explorer. I will be fantastic having this since CMake is one
of the most used build system. Having an cmake interpreter in the web
would probe truly useful for teams and individuals, it will be a
fantastic way to share snippets of cmakescript and show how they are
executed with different cmake versions.
Co-authored-by: Matt Godbolt <matt@godbolt.org>
Adds D8Compiler, which applies to the Android Java and Android Kotlin
languages. D8Compiler instantiates a JavaCompiler or KotlinCompiler
using the java/kotlin dependencies' paths for D8 in the infra repo.
compiler-finder.ts has been updated to allow for duplicate compiler IDs
for 'android-java' and 'android-kotlin', as it is expected that the
compilers used for these languages is the same.
LLVM TableGen is used to generate complex output files in the llvm
project. A generic description of classes and definitions produces
"records" that can then be walked by a TableGen backend to produce
things like C++ code, configuration files, etc.
The biggest examples are LLVM's assembler and disassembler where all the
targets' instructions are defined in TableGen.
https://llvm.org/docs/TableGen/ProgRef.html
An example:
```
class Register<int _size, string _alias=""> {
int size = _size;
string alias = _alias;
}
def X0: Register<8> {}
def X29: Register<8, "frame pointer"> {}
```
```
------------- Classes -----------------
class Register<int Register:_size = ?, string Register:_alias = ""> {
int size = Register:_size;
string alias = Register:_alias;
}
------------- Defs -----------------
def X0 { // Register
int size = 8;
string alias = "";
}
def X29 { // Register
int size = 8;
string alias = "frame pointer";
}
```
It's often a pain point for people new to LLVM so having a quick way to
experiment would be a great benefit for the community (we have a Jupyter
kernel which is good but not as simple as Compiler Explorer).
The compiler for TableGen is `llvm-tblgen`. This comes with most release
builds of LLVM in /bin along with clang and the others. Its default is
to output a text dump of the records defined so that's what I've used
here. This is not executable code so I've disabled the features related
to that.
A user could pass options to `llvm-tblgen` to produce text in a format
other than this, C++ code or JSON for example. However this text dump is
the main use case.
I've re-used an existing clang install, since that includes
`llvm-tblgen` in `bin/`. I just added the 17.01 version for this first
change.
Syntax highlighting is a mix of the Fortran and Ada configuration,
following the language spec I linked above. Though I am very new to that
so it is likely incomplete.
V (`vlang`) is a simple, fast and safe general purpose programming
language compiling to human-readable C.
#### Key features of V:
- simplicity, "only one way to do things"
- performance as fast as C
- safety: no null, no globals, no undefined behavior, immutability
- automatic C to V translation, good C interoperability
- hot code reloading
- flexible memory management (GC by default, manual, arena allocation,
autofree)
- other compilation backends like JavaScript, `native` (wip), `wasm`
(wip) or interpreted
#### Links:
Source code: https://github.com/vlang/v
Official website: https://vlang.io
Web playground: https://play.vlang.io/
infra PR: https://github.com/compiler-explorer/infra/pull/1058
#### Things this PR adds:
- General support for V
- Code inspection for the C, Go and JavaScript backends
- Support for the v formatter `v fmt`
- Some V example code
#### Things not implemented:
- Support for binary-output backends like `native` and `wasm`
- Support for running programs
<!-- 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: Matt Godbolt <matt@godbolt.org>
# Language name
Snowball 🐱
Language version
Snowball v0.0.7-beta
## Language homepage
Soon™️
Not the websites but some (WIP) documentation:
https://snowball-lang.gitbook.io/docs/
Compiler homepage
https://github.com/snowball-lang/snowball
Compiler version
v0.0.7-beta
Motivation
With a myriad of features to offer, Snowball boasts object-oriented
programming, memory safety, built-in functions for enhanced
productivity, and faster execution than other languages. Plus, its
garbage collector and unit testing make it a comprehensive tool for
developers.
> It's still in development but it's development is fast
Related to: https://github.com/compiler-explorer/infra/pull/1017
C3 is a system programming language based on C. It is an evolution of C
enabling the same paradigms and retaining the same syntax as far as
possible.
Design Principles:
Procedural "get things done"-type of language.
Try to stay close to C - only change what's really necessary.
C ABI compatibility and excellent C integration.
Learning C3 should be easy for a C programmer.
Data is inert.
Avoid "big ideas" & the "more is better" fallacy.
Introduce some higher level conveniences where the value is great.
You can try it out live on its tutorial website:
https://www.learn-c3.org
Source code: https://github.com/c3lang/c3c
---------
Co-authored-by: Rubén Rincón Blanco <git@rinconblanco.es>
See https://gitlab.gnome.org/GNOME/vala/ for the language repository.
> Vala is a programming language that aims to bring modern programming
language features to GNOME developers without imposing any additional
runtime requirements and without using a different ABI compared to
applications and libraries written in C.
>
> `valac`, the Vala compiler, is a self-hosting compiler that translates
Vala source code into C source and header files. It uses the GObject
type system to create classes and interfaces declared in the Vala source
code.
>
> The syntax of Vala is similar to C#, modified to better fit the
GObject type system.
I've also created https://github.com/davidmhewitt/vala-builder based on
https://github.com/compiler-explorer/python-builder and tested that it
can build tarballs of arbitrary versions of Vala. I'd be happy to
transfer the ownership of this repository, or feel free to clone it into
the `compiler-explorer` org.
However, I'm a little unsure of how to join up the pieces and get this
Docker builder integrated with the `infra` repository. Let me know where
to go next and I'd be happy to open the relevant PRs.
The recent change to the way NVCC compilation is handled broke support
for NVRTC. NVRTC can only compile device code, so the host-compilation
approach now used for NVCC (using --keep) is incompatible.
This PR gives the NVRTC compiler its own class and restores the old
behavior. The class is a copy of the old NvccCompiler class, with minor
updates to match the code in the new NvccCompiler class where possible
(plus TypeScript).
This PR also removes NVRTC from `cuda.gpu.properties` (because its
output cannot be executed), and updates the list of versions to match
NVCC.
cc @jrhemstad @trxcllnt
Makes the Compiler Explorer app, and all the tooling ESM compatible.
Things that have been done:
1. The package.json has `type: module` now
2. All relative imports have a .js ending
3. All directory imports are now directory/index.js to comply with ESM
standards
4. Dependency node-graceful is now imported into tree, because the
package is broken under esm
5. Dependency p-queue has been bumped to 7.x with ESM support
6. Dependency profanities has been bumped to 3.x with ESM support
7. Webpack config is now both ESM and CommonJS compatible
8. Non-ESM compatible imports have been rewritten
9. ESLint configuration has been tweaked to not fail on .js imports
10. Mocha is now hacked together and ran with ts-node-esm
11. Webpack is now hacked together and ran with ts-node-esm
12. Webpack config is now ESM compatible, so that it can be used in the
dev server
13. Cypress code still runs commonjs, and has been excluded from the
tsconfig
14. All sinon mock tests have been commented out, because sinon module
mocks do not work with ESModules (because ESModules are immutable)
A lot of tests are now giving warnings/errors to stdout, yet still pass.
Docenizer codegenerator scripts have been updated, but I did not re-run
them, and instead just changed their code.
---------
Co-authored-by: Matt Godbolt <matt@godbolt.org>
With the upcoming gcc 13 release and its shiny Modula-2 frontend, we
are introducing Modula-2 support in Compiler Explorer :)
Currently, only the gcc-snapshot build supports modula-2.
fixes#4688
Signed-off-by: Marc Poulhiès <dkm@kataplop.net>