Commit Graph
154 Commits
Author SHA1 Message Date
Ofek 4399adc523 Some minor additions to frontend typing (#7082) 2024-11-14 17:07:51 +02:00
Ofek c1985d64a1 Tsification binge #7 (#6974) 2024-10-25 12:19:04 +03:00
Johel Ernesto Guerrero Peña 601c3ec3d7 feat: update grammar of Cpp2 (#6950) 2024-10-12 18:37:29 +02:00
Spencer FrickeandMatt Godbolt 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
Christoffer LernoandPatrick Quist c419ad593a Update C3 default compiler and do some further fixes to C3-mode. (#6853)
This adds 0.6.2 to the list of C3 compiler versions, and corrects the
operators in c3-mode.

---------

Co-authored-by: Patrick Quist <partouf@gmail.com>
2024-09-30 21:46:15 -05:00
Johel Ernesto Guerrero Peña 36520c83fd feat: update grammar of Cpp2 (#6913) 2024-09-28 18:08:27 +02:00
Christoffer Lerno a8b0030858 Add 0.5.5, 0.6.0, 0.6.1 C3 versions. Remove incorrect keywords from C3. (#6728)
<!-- 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!
-->
This updates C3 with 0.5.5/0.6.0/0.6.1 and removes some long gone
keywords. This also renames "0.4 -> 0.4.0" and "0.5 -> 0.5.0". The new
versions are in the infra pull request here:
https://github.com/compiler-explorer/infra/pull/1374
2024-07-29 21:21:03 -05:00
Jeremy Rifkin f1421bbf89 Add C23 keywords to our C highlighting mode (#6604)
This PR adds new C23 keywords from
https://en.cppreference.com/w/c/keyword. I have some FUD about always
highlighting things like `bool`, since what most people think of as C is
not C23. I think ideally we'd be able to only highlight C23 keywords
when `-std=c23` is being used, but that of course makes things a good
deal more complex. But also, it probably makes sense to just go ahead
and highlight these.

Possibly related to #6568.
2024-06-19 14:30:37 -05:00
Afonso BordadoandPatrick Quist 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
Marc Auberer 5a352d6929 Add new keywords to LLVM IR mode (#6262)
Add new keywords to LLVM IR, taken from the list:
https://llvm.org/docs/LangRef.html#parameter-attributes
2024-04-01 13:54:57 +03:00
cor3ntin afd95a2de4 Highlight module-related keywords (#6155)
These keywords are contextual but the rules are non-trivial so we should
treat them as keywords (like final and override)
2024-02-18 15:38:16 -06:00
Fábio de Souza Villaça Medeiros f855e93fd5 Update Hook syntax (#6113) 2024-02-12 21:56:17 -06: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
Ofek Shilon 02f455aee5 Fix #5801 per the suggestion in the issue discussion 2024-02-03 18:43:54 +02:00
Jeremy Rifkin c02f94233e Add LanguageConfiguration for llvm ir (#5825)
The main point of this is to make ctrl+/ work, also added an entry to
llvm.defaults.properties
2023-11-30 17:52:17 -05:00
Johel Ernesto Guerrero Peña 3ed3b0eb06 feat: update grammar of Cpp2 (#5727) 2023-11-10 11:30:39 +01:00
partouf 0ead74ec8a formatting 2023-10-24 17:18:59 +02: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
Johel Ernesto Guerrero Peña 2de088e691 feat: update grammar of Cpp2 (#5605) 2023-10-22 12:19:52 +02:00
nickpdemarco f7ddcd9859 Add quick and dirty syntax coloring based on swift 2023-10-18 10:15:49 -04:00
nickpdemarco c1c6f30bd7 Remove placeholder syntax coloring, for now 2023-10-11 15:11:21 -04: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
Prabhat Sachdeva cc33ad1a4e Add mode with no syntax highlighting to monaco editor. (#5490)
If `languageId` is not defined, the syntax highlighting in the Monaco
editor panel defaults to **ASM**.
This pull request creates a `no-highlight-mode` with **no syntax
highlighting**. This mode can be used when the syntax highlighting is
not required.

In this PR I've also updated the result of Carbon Language to use this
`no-highlight-mode` as the **ASM** syntax highlighting wasn't matching
the execution trace of Carbon Explorer.
2023-09-22 09:54:41 -04:00
WJKMandRubén Rincón Blanco 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
SpydrandMatt Godbolt 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
nickpdemarco 55a2b1455f Emit Val IR instead of ASM for now 2023-08-02 14:26:24 -04:00
Jeremy Rifkin 3716cbd446 Support control flow graphs from the IR pane (#5155)
On top of #5154


![image](https://github.com/compiler-explorer/compiler-explorer/assets/51220084/7bf25b5b-8988-42ff-9d8c-233e6d817997)

Additionally, while I was here, added support for multiple control flow
graphs to be opened from one compiler instead of disabling the button
once one is opened. And improved the implementation for how this was
done for the llvm opt pipeline.

And did some type work along the way.
2023-06-19 21:48:20 -04:00
aliaegikandRubén Rincón Blanco 91334b9d9b New Language: C3 (#5086)
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>
2023-06-02 08:08:57 -05:00
Johel Ernesto Guerrero Peña c2c5ffd458 feat: parse Cpp2 to highlight it (#5061)
This is the follow-up to #5027.
The test cases: <https://highlight-cpp2.godbolt.org/z/qrqYPvaWE>.

<details><summary>Preview</summary>


![1684378584](https://github.com/compiler-explorer/compiler-explorer/assets/21071787/8fcac705-880c-4ad0-bce9-4c28fe9f0359)

</details>
2023-05-22 22:34:36 -05:00
Siyao (Jane) He 514c3c763f Assembly syntax highlight of comments after code (#5046)
Solving the issue #4876 @jeremy-rifkin 
![Screenshot 2023-05-11 at 9 44 19
AM](https://github.com/compiler-explorer/compiler-explorer/assets/113857408/742c610b-632e-4e8a-a533-082abbbd6e51)
2023-05-14 14:55:37 -04:00
Johel Ernesto Guerrero Peña c76b16ef69 lang(cpp2): improve highlighting (#5027) 2023-05-09 19:18:57 +02:00
David Hewitt a7da7e83c4 Add the Vala programming language (#4955)
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.
2023-04-10 22:47:49 -05:00
nickpdemarco 7a22347e60 Worked through most of AddingALanguage.md 2023-03-17 13:39:35 -04:00
Matt Godbolt 82b1ca9cce Bump to latest monaco (#4854)
Fixes #4355
2023-03-12 12:58:22 -05:00
Matt Godbolt 3461db6c19 Bump all minor versions - npm update; also bump webpack version speculatively... (#4851)
also npm lint and format to make sure any changes turn up.
2023-03-12 11:29:57 -05:00
wxwisiasdf d4623e907c Duplicate COBOL regex matching fix 2023-03-02 22:33:26 +08:00
wxwisiasdf 0e6158b824 Fix COBOL regex issues 2023-03-02 13:52:31 +08:00
wxwisiasdf c359c75b0f COBOL Literals and single-quote form strings 2023-03-02 03:47:26 +08:00
wxwisiasdf 530257357a COBOL comments 2023-03-02 03:44:10 +08:00
wxwisiasdf 3155ecc93a Ident cases in END-PERFORM and etc 2023-03-02 03:04:13 +08:00
wxwisiasdf c48c170f64 Basic COBOL syntax highlighting 2023-03-02 02:58:32 +08:00
Mats Jun LarsenandMatt Godbolt 633eb82d18 Transition to ECMAScript Modules (#4780)
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>
2023-02-27 18:06:38 -06:00
Jeremy Rifkin 384c297906 Fix trailing comma issue (#4775)
Make trailing commas more consistent throughout the project, fixes
config conflict between eslint and prettier. Resolves an oversight in
#4766.
2023-02-26 12:21:35 -05:00
Marc Poulhiès 73f7d0787f Initial support for Modula-2 language (#4747)
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>
2023-02-23 20:43:56 +01:00
Fábio de Souza Villaça Medeiros 7fe0b694c9 Update hook-mode.ts (#4756) 2023-02-19 22:21:35 +00:00
Fábio de Souza Villaça Medeiros 44db15d697 Update hook-mode.ts (#4705)
`hook-mode.ts` file update due to Hook language update.
The `use` keyword has been replaced by `import`.
2023-02-11 18:05:26 +01:00
Jeremy Rifkin 59f8c45246 Update static/modes typing (#4582) 2023-01-13 19:54:26 -05:00
Jeremy Rifkin 07f37abe76 The War of The Types (#4490) 2023-01-13 19:22:25 -05:00
Fábio de Souza Villaça Medeiros 69550eb811 add Hook's icon and update lexicon (#4552) 2023-01-06 14:20:00 -06:00