More languages, we need all the languages
This commit is contained in:
parent
548c1c1162
commit
1ae424f328
|
@ -1,6 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
import * as fs from "fs";
|
||||
import * as mkdirp from "mkdirp";
|
||||
import * as pty from "node-pty";
|
||||
import { IPty } from "node-pty";
|
||||
import * as path from "path";
|
||||
|
@ -104,6 +105,9 @@ export class Session {
|
|||
if (suffix) {
|
||||
code += suffix;
|
||||
}
|
||||
if (main.includes("/")) {
|
||||
await mkdirp(path.dirname(path.resolve(tmpdir, main)));
|
||||
}
|
||||
await new Promise((resolve, reject) =>
|
||||
fs.writeFile(path.resolve(tmpdir, main), code, (err) => {
|
||||
if (err) {
|
||||
|
|
|
@ -156,6 +156,15 @@ require("/usr/lib/node_modules/coffeescript/repl").start()
|
|||
main: "main.exs",
|
||||
run: "iex main.exs",
|
||||
template: `IO.puts("Hello, world!")
|
||||
`,
|
||||
},
|
||||
elvish: {
|
||||
name: "Elvish",
|
||||
monacoLang: "plaintext",
|
||||
repl: "SHELL=/usr/bin/elvish HOME=. elvish",
|
||||
main: ".elvish/rc.elv",
|
||||
run: "SHELL=/usr/bin/elvish HOME=. elvish",
|
||||
template: `echo "Hello, world!"
|
||||
`,
|
||||
},
|
||||
emacs: {
|
||||
|
@ -186,7 +195,7 @@ main() ->
|
|||
monacoLang: "plaintext",
|
||||
repl: "SHELL=/usr/bin/fish fish",
|
||||
main: "main.fish",
|
||||
run: 'fish -C "$(< main.fish)"',
|
||||
run: 'SHELL=/usr/bin/fish fish -C "$(< main.fish)"',
|
||||
template: `echo "Hello, world!"
|
||||
`,
|
||||
},
|
||||
|
@ -197,6 +206,17 @@ main() ->
|
|||
main: "main.fs",
|
||||
run: "gforth main.fs",
|
||||
template: `." Hello, world!" CR
|
||||
`,
|
||||
},
|
||||
fortran: {
|
||||
name: "FORTRAN",
|
||||
monacoLang: "plaintext",
|
||||
main: "main.f",
|
||||
compile: "flang main.f -o main",
|
||||
run: "./main",
|
||||
template: ` program hello
|
||||
print *, "Hello, world!"
|
||||
end program hello
|
||||
`,
|
||||
},
|
||||
fsharp: {
|
||||
|
@ -265,6 +285,15 @@ main = putStrLn "Hello, world!"
|
|||
main: "main.kts",
|
||||
run: "kotlinc -script main.kts; kotlinc",
|
||||
template: `println("Hello, world!")
|
||||
`,
|
||||
},
|
||||
ksh: {
|
||||
name: "Ksh",
|
||||
monacoLang: "shell",
|
||||
repl: "SHELL=/usr/bin/ksh HOME=. ksh",
|
||||
main: ".kshrc",
|
||||
run: "SHELL=/usr/bin/ksh HOME=. ksh",
|
||||
template: `echo "Hello, world!"
|
||||
`,
|
||||
},
|
||||
lolcode: {
|
||||
|
@ -305,6 +334,32 @@ eval.apply(this, [require("fs").readFileSync("main.js", {encoding: "utf-8"})])
|
|||
require("repl").start()
|
||||
'`,
|
||||
template: `console.log("Hello, world!")
|
||||
`,
|
||||
},
|
||||
objectivec: {
|
||||
name: "Objective-C",
|
||||
monacoLang: "objective-c",
|
||||
main: "main.m",
|
||||
compile:
|
||||
"gcc $(gnustep-config --objc-flags) main.m $(gnustep-config --base-libs) -o main",
|
||||
run: "./main",
|
||||
template: `#import <Foundation/Foundation.h>
|
||||
|
||||
int main() {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
NSLog(@"Hello, world!");
|
||||
[pool drain];
|
||||
return 0;
|
||||
}
|
||||
`,
|
||||
},
|
||||
perl: {
|
||||
name: "Perl",
|
||||
monacoLang: "perl",
|
||||
repl: "re.pl",
|
||||
main: "main.pl",
|
||||
run: "re.pl --rcfile ./main.pl",
|
||||
template: `print("Hello, world!\\n")
|
||||
`,
|
||||
},
|
||||
php: {
|
||||
|
@ -316,6 +371,15 @@ require("repl").start()
|
|||
template: `<?php
|
||||
|
||||
echo "Hello, world!\\n";
|
||||
`,
|
||||
},
|
||||
powershell: {
|
||||
name: "PowerShell",
|
||||
monacoLang: "powershell",
|
||||
repl: "SHELL=/usr/bin/pwsh pwsh",
|
||||
main: "main.ps1",
|
||||
run: "SHELL=/usr/bin/pwsh pwsh -NoExit main.ps1",
|
||||
template: `Write-Host "Hello, world!"
|
||||
`,
|
||||
},
|
||||
python: {
|
||||
|
@ -370,6 +434,15 @@ binding_irb.run(IRB.conf)
|
|||
template: `fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
`,
|
||||
},
|
||||
scala: {
|
||||
name: "Scala",
|
||||
monacoLang: "plaintext",
|
||||
repl: "scala",
|
||||
main: "main.scala",
|
||||
run: "scala -i main.scala",
|
||||
template: `println("Hello, world!")
|
||||
`,
|
||||
},
|
||||
scheme: {
|
||||
|
@ -381,6 +454,15 @@ binding_irb.run(IRB.conf)
|
|||
template: `(begin
|
||||
(display "Hello, world!")
|
||||
(newline))
|
||||
`,
|
||||
},
|
||||
sh: {
|
||||
name: "Sh",
|
||||
monacoLang: "shell",
|
||||
repl: "SHELL=/usr/bin/sh HOME=. posh -l",
|
||||
main: ".profile",
|
||||
run: "SHELL=/usr/bin/sh HOME=. posh -l",
|
||||
template: `echo "Hello, world!"
|
||||
`,
|
||||
},
|
||||
sqlite: {
|
||||
|
@ -399,6 +481,24 @@ binding_irb.run(IRB.conf)
|
|||
compile: "swiftc main.swift",
|
||||
run: "./main",
|
||||
template: `print("Hello, world!")
|
||||
`,
|
||||
},
|
||||
tcl: {
|
||||
name: "Tcl",
|
||||
monacoLang: "tcl",
|
||||
repl: "tclsh",
|
||||
main: ".tclshrc",
|
||||
run: "HOME=. tclsh",
|
||||
template: `puts {Hello, world!}
|
||||
`,
|
||||
},
|
||||
tcsh: {
|
||||
name: "Tcsh",
|
||||
monacoLang: "shell",
|
||||
repl: "SHELL=/usr/bin/tcsh HOME=. tcsh",
|
||||
main: ".tcshrc",
|
||||
run: "SHELL=/usr/bin/tcsh HOME=. tcsh",
|
||||
template: `echo "Hello, world!"
|
||||
`,
|
||||
},
|
||||
typescript: {
|
||||
|
@ -432,7 +532,7 @@ binding_irb.run(IRB.conf)
|
|||
monacoLang: "shell",
|
||||
repl: "SHELL=/usr/bin/zsh zsh",
|
||||
main: ".zshrc",
|
||||
run: "ZDOTDIR=. zsh",
|
||||
run: "SHELL=/usr/bin/zsh ZDOTDIR=. zsh",
|
||||
template: `echo "Hello, world!"
|
||||
`,
|
||||
},
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
"express-ws": "^4.0.0",
|
||||
"file-loader": "^6.0.0",
|
||||
"heroku-ssl-redirect": "^0.0.4",
|
||||
"mkdirp": "^1.0.4",
|
||||
"monaco-editor": "^0.20.0",
|
||||
"node-pty": "^0.9.0",
|
||||
"style-loader": "^1.2.1",
|
||||
|
|
|
@ -86,6 +86,9 @@ dart
|
|||
# Elixir
|
||||
elixir
|
||||
|
||||
# Elvish
|
||||
elvish
|
||||
|
||||
# Emacs Lisp
|
||||
emacs-nox
|
||||
|
||||
|
@ -98,6 +101,9 @@ fsharp
|
|||
# Fish
|
||||
fish
|
||||
|
||||
# FORTRAN
|
||||
flang-7
|
||||
|
||||
# Forth
|
||||
gforth
|
||||
|
||||
|
@ -114,6 +120,9 @@ default-jdk
|
|||
# Julia
|
||||
julia
|
||||
|
||||
# Ksh
|
||||
ksh
|
||||
|
||||
# LOLCODE
|
||||
cmake
|
||||
|
||||
|
@ -127,6 +136,14 @@ nim
|
|||
nodejs
|
||||
yarn
|
||||
|
||||
# Objective-C
|
||||
gcc
|
||||
gnustep-devel
|
||||
|
||||
# Perl
|
||||
perl
|
||||
perlconsole
|
||||
|
||||
# PHP
|
||||
php
|
||||
|
||||
|
@ -144,15 +161,27 @@ ruby
|
|||
# Rust
|
||||
rustc
|
||||
|
||||
# Scala
|
||||
scala
|
||||
|
||||
# Scheme
|
||||
mit-scheme
|
||||
|
||||
# Sh
|
||||
posh
|
||||
|
||||
# SQLite
|
||||
sqlite
|
||||
|
||||
# Swift
|
||||
libpython2.7
|
||||
|
||||
# Tcl
|
||||
tcl
|
||||
|
||||
# Tcsh
|
||||
tcsh
|
||||
|
||||
# Unlambda
|
||||
unlambda
|
||||
|
||||
|
@ -178,6 +207,9 @@ npm install -g ts-node typescript
|
|||
# ReasonML
|
||||
npm install -g bs-platform
|
||||
|
||||
# Perl
|
||||
cpan Devel::REPL
|
||||
|
||||
# Needed for project infrastructure
|
||||
cd /tmp
|
||||
wget -nv https://github.com/watchexec/watchexec/releases/download/1.13.1/watchexec-1.13.1-x86_64-unknown-linux-gnu.deb
|
||||
|
@ -192,6 +224,13 @@ cp kotlinc/bin/* /usr/bin/
|
|||
cp kotlinc/lib/* /usr/lib/
|
||||
rm -rf kotlin-*.zip kotlinc
|
||||
|
||||
# PowerShell
|
||||
cd /tmp
|
||||
wget -nv https://github.com/PowerShell/PowerShell/releases/download/v7.0.1/powershell-7.0.1-linux-x64.tar.gz
|
||||
mkdir /opt/powershell
|
||||
tar -xf powershell-*.tar.gz -C /opt/powershell
|
||||
ln -s /opt/powershell/pwsh /usr/bin/pwsh
|
||||
|
||||
# Swift
|
||||
cd /tmp
|
||||
wget -nv https://swift.org/builds/swift-5.2.4-release/ubuntu2004/swift-5.2.4-RELEASE/swift-5.2.4-RELEASE-ubuntu20.04.tar.gz
|
||||
|
@ -231,6 +270,8 @@ while True:
|
|||
except EOFError:
|
||||
print("^D")
|
||||
break
|
||||
if not code:
|
||||
continue
|
||||
with tempfile.NamedTemporaryFile(mode="w") as f:
|
||||
f.write(code)
|
||||
f.flush()
|
||||
|
@ -261,6 +302,8 @@ while True:
|
|||
except EOFError:
|
||||
print("^D")
|
||||
break
|
||||
if not code:
|
||||
continue
|
||||
subprocess.run(["unlambda"], input=code, encoding="utf-8")
|
||||
EOF
|
||||
chmod +x /usr/bin/unlambda-repl
|
||||
|
|
|
@ -2080,6 +2080,11 @@ mkdirp@^0.5.1, mkdirp@^0.5.3:
|
|||
dependencies:
|
||||
minimist "^1.2.5"
|
||||
|
||||
mkdirp@^1.0.4:
|
||||
version "1.0.4"
|
||||
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e"
|
||||
integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==
|
||||
|
||||
monaco-editor@^0.20.0:
|
||||
version "0.20.0"
|
||||
resolved "https://registry.yarnpkg.com/monaco-editor/-/monaco-editor-0.20.0.tgz#5d5009343a550124426cb4d965a4d27a348b4dea"
|
||||
|
|
Loading…
Reference in New Issue