aboutsummaryrefslogtreecommitdiff
path: root/examples
Commit message (Collapse)AuthorAge
* Add profile support for dex2oat. (#6382)gh-11554kevinjeon-g2024-04-29
| | | | | | | | | | | | 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.
* Aarch64 asm example to add elements of two arrays. (#6177)gh-11203Prathamesh Kulkarni2024-04-01
| | | | | | | | | | | | | | | | | | <!-- 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>
* New language: Spice (#6105)Marc Auberer2024-02-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add Elixir language support (#6081)gh-10510Andrea Tomasi2024-02-05
| | | | | | | | | | | | | | | | | | | | | 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)
* Add prepare hint to javascript example (#6016)gh-10237Charles Munger2024-01-16
| | | | | | | | | 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.
* Add note to Rust example explaining why functions are missing in the output ↵gh-10235narpfel2024-01-16
| | | | | | | | | | | (#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.
* Updated examples and changed to snowball 0.1.0 (#5969)gh-10189Mauro Baladés2024-01-15
|
* lang: add cmakescript language (#5815)gh-9858Vicente Bolea2023-12-04
| | | | | | | | | | | | 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>
* Add support for Android D8 (8.1.56) (#5756)gh-9853kevinjeon-g2023-12-04
| | | | | | | | | | 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.
* Add GIMPLE (#5817)gh-9795Jeremy Rifkin2023-12-03
| | | | | | | | | 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>
* Added support for intel and new examples (#5754)gh-9646Mauro Baladés2023-11-21
|
* New snowball syntax (#5738)gh-9565Mauro Baladés2023-11-13
| | | | | | | | | | | | | | <!-- 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! -->
* Updated snowball to version 8 (#5730)gh-9515Mauro Baladés2023-11-12
|
* LLVM TableGen: Improve docstring for Actions Override and add example (#5711)gh-9422David Spickett2023-11-07
| | | | | | | | | | | | | | | | | | | | | | | | 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! -->
* Add the LLVM TableGen language (#5629)gh-9205David Spickett2023-10-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* rename val to hylonickpdemarco2023-10-11
|
* Merge main, resolve conflicts with valanickpdemarco2023-10-11
|\
| * jakt: Fix signature of default example's main (#5507)gh-8819WJKM2023-09-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * New Language: V (#5297)gh-8493Spydr2023-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Added snowball lang (#5245)gh-8125Mauro Baladés2023-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # 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
| * New Language: C3 (#5086)gh-7530aliaegik2023-06-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * Missing line endingsgh-7079Matt Godbolt2023-04-10
| |
| * Add the Vala programming language (#4955)gh-7078David Hewitt2023-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * Add d8 for disassembling javascript (#4721)gh-6985Gaurav Gautam2023-04-01
| | | | | | https://github.com/compiler-explorer/compiler-explorer/issues/264
| * Add MLIR 16.0.0 (#4892)gh-6964Patrick Quist2023-03-30
| |
* | Worked through most of AddingALanguage.mdnickpdemarco2023-03-17
|/
* Update default fortran example (#4807)Airbus57172023-03-11
| | | | integer reflects a more accurate example compared to other languages in the code
* Add basic COBOL supportwxwisiasdf2023-03-01
|
* Language support for LLVM Machine IR (#4763)gh-6438Yashwant Singh2023-02-24
| | | | | | | Resolves #4762 --------- Co-authored-by: Yashwant <yassingh@amd-blr-comp-03f7.amd.com>
* Initial support for Modula-2 language (#4747)gh-6431Marc Poulhiès2023-02-23
| | | | | | | | | | 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>
* Initial support for Objective-C/Objective-C++gh-5918gh-5916Marc Poulhiès2023-01-21
| | | | | | | | | | | | | | | Currently only list GCC compilers as a first step. Will add clang in a followup change. Port gcc.js to Typescript (simple renaming). Package the objectivec language support for Monaco. Add very basic example. Something more objc/objc++ specific would be better. fixes #2942 Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
* Add Julia (#4595)gh-5817Alex2023-01-14
|
* jakt: Fix signature of default example's main (#4522)gh-5625Andrew Kaster2023-01-02
| | | And make sure to cast the i32 to a c_int from the example function.
* Fix typogh-5103Matt Godbolt2022-11-27
|
* Support trunk and execution for .NET (#4351)gh-5100Steve2022-11-27
| | | | | | * Support trunk and execution for .NET * Adjust compilers order * Support stdin * Update samples
* Add basic Racket support (#4098)gh-4407J. Ryan Stinnett2022-10-05
|
* Allow the C examples to build with a C89 compiler (#4104)gh-4388Cameron Cawley2022-10-02
|
* Add basic support for Hook programming language (#4075)gh-4355Fábio de Souza Villaça Medeiros2022-09-25
| | | | * Add basic support for Hook programming language
* Fixes for cppfront (#4076)gh-4280Matt Godbolt2022-09-20
| | | | | | | * Rename cppx_cppfront to cpp2_cppfront * Add some blurb about the compiler * Some syntax highlighting * Better output highlighting * Some form of line tracking and filtering
* cppfront (#4069)gh-4247Matt Godbolt2022-09-16
|
* Add preliminary HLSL support (#3932)gh-3870Jeremy Ong2022-08-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add preliminary HLSL support - Adds a new language mode to monaco, extending the base C++ layer with HLSL intrinsics and types - Adds a new `HLSLCompiler` class - Adds a sample pixel shader The compiler used to test this locally is the [DirectX Shader Compiler](https://github.com/microsoft/DirectXShaderCompiler) (aka DXC), which needs to also be added to the [infra](https://github.com/compiler-explorer/infra) project. Some guidance is needed before this PR can be merged: 1. While DXC can run on Linux, there are no binaries available so this compiler must be built. Are there examples that show how we should do this as part of the infra CI/CD? Should we build and host it separately instead? The build process for DXC on Linux is relatively straightforward and documented [here](https://github.com/microsoft/DirectXShaderCompiler/blob/main/docs/DxcOnUnix.rst). 2. The example code doesn't compile unless the user also supplies additional compiler flags `-T ps_6_6 -E PSMain`. Is there a way to load these flags conditionally only if the sample is loaded? 3. Technically, DXC emits DXIL IR (based on LLVM IR) and I am wondering if it's possible to extend an existing LLVM backend. In addition, the `-spirv` compiler flag could be emitted to target the SPIR-V backend instead, so I'm curious if there is a good way to express the target backend. Signed-off-by: Jeremy Ong <jeremycong@gmail.com> * Fix copyright dates, remove unnecessary strict usage, and remove placeholder logo Signed-off-by: Jeremy Ong <jeremycong@gmail.com> * Rebase and remove unneeded HLSL logo Signed-off-by: Jeremy Ong <jeremycong@gmail.com> * Fix lint errors Signed-off-by: Jeremy Ong <jeremycong@gmail.com> * Simply HLSL sample and remove default config Signed-off-by: Jeremy Ong <jeremycong@gmail.com>
* Add basic CIRCT compiler support. (#3917)gh-3810Mike Urbach2022-07-28
| | | | | | | | | | | | * Add basic CIRCT compiler support. This adds basic support for CIRCT as requested in #3825. The addition is based on the similar additions for MLIR in #3733 and #3770. * Update path and rename compiler in circt.amazon.properties. * Update circt.amazon.properties Co-authored-by: Patrick Quist <partouf@gmail.com>
* Add support for Carbon (#3885)gh-3675Matt Godbolt2022-07-19
| | | Add support for the Carbon language prototype.
* fix pony examplegh-3667Patrick Quist2022-07-18
|
* fix pony examplegh-3666Patrick Quist2022-07-18
|
* Pony Lang Config (#3855)gh-3615Christopher Smyth2022-07-10
|
* add hellowgh-3606partouf2022-07-09
|
* Add the jakt programming language (#3845)gh-3605TrMen2022-07-09
|
* Toit (#3808)gh-3459Patrick Quist2022-06-24
|
* Fix typo in Ada example (#3793)gh-3384SeekingBlues2022-06-20
|