compiler-discord/README.md

91 lines
1.1 KiB
Markdown
Raw Normal View History

2019-03-12 10:09:46 +01:00
# Comp_iler
Sandboxed code execution discord bot.
## Usage
### Code Blocks
````
>```lang
code
```
````
With options:
````
2019-03-13 06:54:36 +01:00
>options```lang
2019-03-12 10:09:46 +01:00
code
```
````
### Inline Code
```
>`lang code`
```
With options:
````
2019-03-13 06:54:36 +01:00
>options`lang code`
2019-03-12 10:09:46 +01:00
````
### Examples
````
>```hs
main :: IO ()
main = print 1
```
````
````
2019-03-13 06:54:36 +01:00
>harmony```js
2019-03-12 10:09:46 +01:00
class Foo {
bar = 1;
}
console.log(new Foo().bar);
```
````
```
>`py print('hello world')`
```
2019-03-13 06:54:36 +01:00
```
>e`hs (+) <$> Just 1 <*> Just 2`
```
2019-03-12 10:09:46 +01:00
## Supported Languages
One of the following languages is set in `lang`.
- `js` JavaScript (Node 11.11.0)
- `py` Python (CPython 3.7.2, CPython 2.7.16)
- `hs` Haskell (GHC 8.6.3)
2019-03-13 05:37:28 +01:00
- `pas` Pascal (FPC 3.0.4)
2019-03-13 05:58:43 +01:00
- `go` Go (Go 1.12)
2019-03-12 10:09:46 +01:00
## Options
Options are optionally set in `options`, which is a semicolon-delimited list of `flag` or `flag=value`.
For JavaScript:
- `harmony` enables harmony features (`--harmony` on node)
2019-03-13 06:51:49 +01:00
- `e` prints the result of evaluating the code
2019-03-12 10:09:46 +01:00
For Python:
- `2` runs Python 2 instead of Python 3
2019-03-12 10:09:46 +01:00
For Haskell:
2019-03-13 06:51:49 +01:00
- `e` evaluates a single expression instead of a module
2019-03-12 10:09:46 +01:00
2019-03-13 05:37:28 +01:00
For Pascal:
- None
2019-03-13 05:58:43 +01:00
For Go:
- None