169 Commits

Author SHA1 Message Date
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
Abhilash Majumder
4649b3dd0e Add PTX as a separate module from assembler (#7615) 2025-05-12 12:51:03 -05:00
Rucadi
aa5c02fa70 Add Nix Language (#6198) 2025-05-11 16:07:40 -05:00
Marc Poulhiès
fb058d96a5 Update default.a68
Algol68 frontend has again changed some syntax, updating the example to match latest changes.
2025-04-24 09:47:16 +02:00
Marc Poulhiès
d1073529e6 Update default.a68
Follow latest developments and update the default program.
2025-04-23 21:54:42 +02:00
narpfel
ae21fbbffc Make default Rust code compatible with 2024 edition (#7581) 2025-04-20 04:52:25 +00:00
Tim Hutt
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
Marc Poulhiès
4b9191ab96 algol68: adjust the default program again
Can't really explain them, but this is now the correct one.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-03-28 16:31:50 +01:00
Marc Poulhiès
eeab22a0b3 algol68: adjust default program
After https://inbox.sourceware.org/algol68/87msd7n6al.fsf@gnu.org/T/#t
adjust the default program (and remove the PROGRAM line)

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-03-26 18:08:27 +01:00
Michele Martone
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 Batty
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
Rupert Tombs
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
Matt Godbolt
9f3d43b271 Add carbon native compiler (#7389)
- Renames existing carbon stuff to carbon-explorer. Will need a quick
infra install and will temporarily (like, for 2m) break things during
deploy.
- Adds carbon binary support
- Supports binary, execute, and binary objects
- Updates the default carbon file as best I can
 
Closes #5402
2025-02-12 13:41:08 -06:00
Marc Poulhiès
ce11ca3808 Add new language: Algol68 and corresponding GCC frontend (#7346)
refs https://github.com/compiler-explorer/compiler-explorer/issues/7258

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2025-01-31 08:37:48 +01:00
Aleksei Nurmukhametov
1d78d0248e Update default ISPC example (#7286) 2025-01-22 00:09:35 +01:00
kevinjeon-g
5e23a935de Add full oatdump output behind filters (#7233)
This change makes full oatdump output visible behind the "Directives"
filter. This does the same thing as the --full-output flag, but is
more-easily used. The default code snippets have been updated to include
this.
2024-12-20 11:58:18 -06:00
Waqar Ahmed
d3ef2de208 Add Odin language (#7186) 2024-12-06 17:28:47 +01:00
Spencer Fricke
05f86a38dd Add preliminary Slang support (#7151)
Part of
https://github.com/compiler-explorer/compiler-explorer/issues/2331 and
similar to [my GLSL
change](https://github.com/compiler-explorer/compiler-explorer/pull/6883)

[Slang](https://shader-slang.com/) is a GPU focused shading language
that has been worked on for years. Last week [The Khronos
Group](https://www.khronos.org/news/press/khronos-group-launches-slang-initiative-hosting-open-source-compiler-contributed-by-nvidia)
will now be running the project as open governance. The latest [Vulkan
SDK](https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-3-296-0-for-windows-linux-macos/)
has also added a build of `Slangc` (slang compiler).

This change adds support for Slang (the language) as a front end with
`Slangc` (the compiler) as the only compiler. Slang can be used for
things like GLSL/HLSL, but that is for a future PR.

I am in contacts with people on the Slang development and plan to
support things for Slang as well as the other GPU related shading
languages

--- 

of course, screen shots as well


![image](https://github.com/user-attachments/assets/c9f6460b-b779-4ff5-b0bb-5a7eff543de1)


![image](https://github.com/user-attachments/assets/b2dbdd5a-c031-4110-ab9d-ed76b9881ad8)
2024-12-04 04:45:50 -06:00
chibitanaka
86f439fc92 Add Vyper support (#7088)
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!
2024-11-26 16:38:40 -06:00
Spencer Fricke
02603a6371 Add SPIR-V language with SPIRV-Tools compilers (#6947)
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)

![image](https://github.com/user-attachments/assets/419feab0-d030-4578-b32a-ef1cf95701da)

![image](https://github.com/user-attachments/assets/a00fa60f-7f05-4522-a9fc-1c43ecee1c42)
2024-10-28 21:24:50 -05:00
Cr0a3
43fbfcd19f Adding ylc (#6982)
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
2024-10-22 06:37:40 -05:00
Steve
30b77d380e IL: Fixes include path for Linux (#6922) 2024-10-01 14:32:19 +02:00
Spencer Fricke
69241006aa Add preliminary GLSL support (#6883)
Part of
https://github.com/compiler-explorer/compiler-explorer/issues/2331
Inspired by
https://github.com/compiler-explorer/compiler-explorer/pull/3932

I think it is great that HLSL has support here, but the lack of GLSL
support is what stops me from using Compiler-Explorer more often. LunarG
also have shown in our [yearly ecosystem
survey](https://www.lunarg.com/wp-content/uploads/2024/04/2024-Vulkan-Ecosystem-Survey-Results-04-04-2024.pdf)
that GLSL is very widely used in the GPU space

![image](https://github.com/user-attachments/assets/ec740d61-0bf4-42b2-8e51-c204819aba11)

A while ago I started to create [my own SPIR-V
tool](https://github.com/sjfricke/SPIRV-Playground) but was given
feedback to "please just spend your free-time efforts making
compiler-explorer better for SPIR-V instead" ... to which I agree (since
seems a LOT of ground work was already laid out for me 😄 )

So here it is, a working version of GLSL using `glslang` 🚀 


![image](https://github.com/user-attachments/assets/2fc67890-1cd2-4b7e-82c2-30ca135f8590)

I guess beside reviewing my very unused Typescript skills, I know we
will need to add things to the Infra repo to get things public. For that
I am not sure what the best course of action is, we do have [rolling
releases](https://github.com/KhronosGroup/glslang/releases/tag/main-tot)
of `glslang` as well as SDK version tags

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2024-09-30 22:19:55 -05:00
Steve
ee2dc8ab00 Update asm parser and add support for IL and IL disassembler (#6856)
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
2024-09-29 13:15:47 -05:00
cepheus
5fbfed1bad Update test example for circt (#6694)
As the circt project has evolved over the past two years, the old
example no longer work with the current circt compiler. This commit
corrects the IR examples according to the new HW dialect, Seq dialect
definitions.
2024-07-10 09:04:05 +02:00
Matt Godbolt
19ed6d000e Revert "Pull Request: nasm-hello.asm -> hello_nasm.asm (#6667)"
This reverts commit 173ceddcaa.
2024-07-01 19:52:01 -05:00
Tai Husk
173ceddcaa Pull Request: nasm-hello.asm -> hello_nasm.asm (#6667) 2024-06-29 10:13:05 +02:00
Tai Husk
8d8d546ae5 Update default.asm for interactive Hello World example (#6647) 2024-06-28 22:17:06 +02:00
kevinjeon-g
1c051bd479 Add R8 for Android (#6591)
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
2024-06-25 18:43:02 -05:00
kevinjeon-g
99617a29b2 Move dex2oat profiles from inline to template (#6621)
This change moves the dex2oat profiles for Android Java and Kotlin from
the inline comments (included as part of the default code example) to
being included as a separate file. Templates have been added for this.
2024-06-24 21:33:31 -05:00
Afonso Bordado
bdb5feaea3 Add webassembly language (#6429)
👋 Hey,

This PR adds support for the Webassembly Text Language (#1871).
Currently it only supports the
[wasmtime](https://github.com/bytecodealliance/wasmtime) compiler, but
it should be possible to add others (i.e. v8 / wasmer / etc...).

It looks like the monaco does not support the WAT language, so I've
added a simple mode for it, that is mostly copied from the clojure mode
with some changes. From what I've tested it seems to work reasonably
well.


![image](https://github.com/compiler-explorer/compiler-explorer/assets/1357143/9e38b28e-235c-47e5-a71e-50217e5d2056)

---------

Co-authored-by: Patrick Quist <partouf@gmail.com>
2024-06-10 21:29:03 -05:00
kevinjeon-g
b94781ab48 Add profile support for dex2oat. (#6382)
dex2oat supports profile-guided compilation. In addition to taking dex
code as an input, it can take a profile as another input, to guide the
compilation. The profile determines which methods need to be compiled,
how calls can be inlined, and so on.

Because Compiler Explorer doesn't support multiple input files, the
profile is added as a comment block in the Java/Kotlin source code. A
post-processor extracts the profile from the comment block into a
separate file, in order to input it to dex2oat.
2024-04-29 20:17:24 -05:00
Prathamesh Kulkarni
722c2b1437 Aarch64 asm example to add elements of two arrays. (#6177)
<!-- 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: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
2024-04-01 22:09:08 -05:00
Marc Auberer
54dda76f22 New language: Spice (#6105)
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
2024-02-12 21:50:33 -06:00
Andrea Tomasi
1cacc9ce79 Add Elixir language support (#6081)
Hi, I am adding support for the Elixir language
(https://github.com/compiler-explorer/compiler-explorer/issues/3947)
I have done this so far. It is not perfect but at least is something I
can work with.
 
In Elixir you can write several modules in the same file, so I show the
different compile utins as a list.

It works locally but I don't know how to add the Elixir language to
[infra](https://github.com/compiler-explorer/infra/)

Some notes:
- I think Elixir's macro system may be a potential security issue
because I can run code during compilation.
- The decompiled code contains a reference to the file path on the
system machine.


![elixir_compiler](https://github.com/compiler-explorer/compiler-explorer/assets/11353602/59e46c98-646d-4275-9c03-e4097a4977ef)
2024-02-05 20:54:01 -06:00
Charles Munger
c52a53b160 Add prepare hint to javascript example (#6016)
Without this additional line, v8 trunk produces no output, and v8 11.3
produces a bunch of assembly with no `imull` instruction.

I don't actually know much about v8 or javascript, but based on [this
mailing list
post](https://groups.google.com/g/v8-users/c/xlx22gScRNs/m/yE2-boWsBQAJ)
and testing on godbolt.org, this works.
2024-01-16 22:13:22 -06:00
narpfel
21aaec6be5 Add note to Rust example explaining why functions are missing in the output (#6013)
Resolves #5939.

Rust issue about this problem:
https://github.com/rust-lang/rust/issues/119850

Hopefully this can be reverted again when there is a fix on the Rust
side.
2024-01-16 22:02:20 -06:00
Mauro Baladés
b4ca920fa5 Updated examples and changed to snowball 0.1.0 (#5969) 2024-01-15 15:18:59 -06:00
Vicente Bolea
20d2852138 lang: add cmakescript language (#5815)
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>
2023-12-04 21:03:50 -06:00
kevinjeon-g
7efe253f5f Add support for Android D8 (8.1.56) (#5756)
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.
2023-12-04 19:35:56 -06:00
Jeremy Rifkin
7680595a88 Add GIMPLE (#5817)
This PR adds GIMPLE as a language

![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/42d2b423-0d87-4a41-b762-3d8b4e7cedd2)

---------

Co-authored-by: Marc Poulhiès <dkm@kataplop.net>
2023-12-03 11:34:25 -05:00
Mauro Baladés
d2f4617d0d Added support for intel and new examples (#5754) 2023-11-21 18:12:05 -06:00
Mauro Baladés
058dc15581 New snowball syntax (#5738)
<!-- 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!
-->
2023-11-13 20:08:09 -06:00
Mauro Baladés
0ac5f15d14 Updated snowball to version 8 (#5730) 2023-11-12 14:24:10 -06:00
David Spickett
28e607057c LLVM TableGen: Improve docstring for Actions Override and add example (#5711)
A majority of the actions/backends expect to find certain classes and
definitions in the source code. There's no canonical reference for this
so it's a combination of incomplete docs and the actual uses in
llvm-project.

(most of the time I expect people will come from llvm-project to
experiment, rather than the other way around)

I've added an example that uses the Searchable Tables backend.

<!-- 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!
-->
2023-11-07 00:32:24 +01:00
David Spickett
5f3db78dce Add the LLVM TableGen language (#5629)
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.
2023-10-23 19:59:46 -05:00
nickpdemarco
4ee6cda52f rename val to hylo 2023-10-11 15:01:45 -04:00
nickpdemarco
9cda199e40 Merge main, resolve conflicts with vala 2023-10-11 14:43:05 -04:00
WJKM
bb33f8fc18 jakt: Fix signature of default example's main (#5507)
In a precious version of the language, functions were defined with the
`function` keyword. They are now defined with `fn`.

Currently, the default example doen't compile.

<!-- 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: Rubén Rincón Blanco <git@rinconblanco.es>
2023-09-22 13:18:00 +02:00
Spydr
0bf769e245 New Language: V (#5297)
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>
2023-08-15 22:16:36 -05:00