ONLINE

Compiler

discord.js

A discord compiler bot which compiles your spaghetti

Created By: Headline# 9999

Discord Compiler

A Discord bot which can compile code, display assembly, display the output of the compiler, and run the program. This bot is great for prototyping ideas, or testing concepts on-the-fly with very little effort. It supports almost every programing language you could name (c++, c, java, python, ruby, javascript, go, php, lua, & more!).

Commands

There are a few commands that this bot has, if you ever forget them feel free to type ;help.

;languages

The first command is this one. It shows you all the languages that this bot currently supports. The reactions underneath the post are how you navigate the menu. Clicking right moves you a page, clicking left moves you back. You can see your page number in the bottom corner.

;compilers

For languages requiring compilation, you can specify exactly which compiler you'd like to use. This can be useful for comparing errors, warning messages, or other non-standard features. If you want to use a specific compiler, remember which one you want to use from that list and keep that in mind for the next command, ;compile.

;compile

This command is perhaps the most complicated, but once you get the hang of it prototyping is very simple. There are three parts to this command.

  1. ;compile
    • This is the first part of the command, and indicates that we'll be compiling code!
  2. the language or compiler
    • The second argument of the ;compile command is the language which you'd like to use, or the specific compiler you'd like to use for that language. If you just specify the language, it grabs the first compiler in the ;compilers list.
  3. the code
    • The last part of this command is the code you'd like to execute. This is posted in code-block form for the bot to read, and for everyone to see.

The full break down of what should be typed in a discord message is exactly this.

;compile c++
```
#include <iostream>
int main ()
{
    int a = 4;
    std::cout << a << std::endl;
}
```

or, if you wish to use clang-3.8.1.

;compile clang-3.8.1
```
#include <iostream>
int main ()
{
    int a = 4;
    std::cout << a << std::endl;
}
```

Add Compiler Flags

You can also add compilation flags to enable different features, warnings, or whatever you'd need. Here's our example message and how to format it to get warnings.

;compile c++ -std=c++17 -Wall -Wextra -O2
```cpp
#include <iostream>

int main() {
    register int a = 4;
    printf("test\n");
}
```

Using stdin

You have the ability to pipe in your own input into your programs. This can be done two ways

;compile c++ | input goes here
```
<code>
```

or

;compile c++
```
input goes here
```
```
<code>
```

;asm

You can compile and view the output assembly if you’d like. This command is similar to the others, following the same exact syntax for the compile command, an example request would look like this

;asm c++

```
int sum(int a, int b) {
    return a+b;
}

```

;asm compilers

If you’d like to try a different compiler you can use this command to view the compilers available for this feature, here’s what that should look like

;asm compilers c++

Then, the bot will give you a menu with all of the available compilers for the supplied language

Questions?

If you have any questions join the support server and ask there!