Evaluate code in a sandboxed environment everywhere with TryItOnline.
Before getting to the examples, please note that tio.js supports a wide variety of programming languages. These programming languages contain their own IDs that can be used in customizing the programming language to use.
For example javascript-node is for running JavaScript in a Node.js runtime, python3 is for running in a Python 3 environment, etc.
In code, these can be retrieved programmatically by using:
console.log(tio.languages)
// => ['05ab1e', '1l-a', '1l-aoi', '2dfuck', ...]Therefore, here are the full list of supported programming languages alongside with their IDs in alphabetical order for your convenience.
Practical programming languages (260)
Esoteric programming languages (421)
| Name | ID |
|---|---|
| 4 | 4 |
| 7 | 7 |
| 33 | 33 |
| 99 | 99 |
| 05AB1E (legacy) | 05ab1e |
| 1L_a | 1l-a |
| 1L_AOI | 1l-aoi |
| 2DFuck | 2dfuck |
| 2L | 2l |
| 2sable | 2sable |
| 3var | 3var |
| a-gram | a-gram |
| A Pear Tree | a-pear-tree |
| Acc!! | accbb |
| Aceto | aceto |
| Actually | actually |
| Adapt | adapt |
| Add++ | addpp |
| ADJUST | adjust |
| Agony | agony |
| Ahead | ahead |
| Aheui (esotope) | aheui |
| Alchemist | alchemist |
| Alice | alice |
| Alice & Bob | alice-bob |
| AlphaBeta | alphabeta |
| Alphabetti spaghetti | alphabetti-spaghetti |
| Alphuck | alphuck |
| Alumin | alumin |
| The Amnesiac From Minsk | amnesiac-from-minsk |
| Ante | ante |
| anyfix | anyfix |
| ARBLE | arble |
| Archway | archway |
| Archway2 | archway2 |
| Arcyóu | arcyou |
| ArnoldC | arnoldc |
| AsciiDots | asciidots |
| Aubergine | aubergine |
| axo | axo |
| Backhand | backhand |
| Bitwise Cyclic Tag But Way Worse | bctbww |
| Bitwise Cyclic Tag But Way Worse 2.0 | bctbww2 |
| Beam | beam |
| Bean | bean |
| Beatnik | beatnik |
| Beeswax | beeswax |
| Befunge-93 | befunge |
| Befunge-93 (FBBI) | befunge-93-fbbi |
| Befunge-93 (MTFI) | befunge-93-mtfi |
| Befunge-93 (PyFunge) | befunge-93-pyfunge |
| Befunge-96 (MTFI) | befunge-96-mtfi |
| Befunge-97 (MTFI) | befunge-97-mtfi |
| Befunge-98 (FBBI) | befunge-98 |
| Befunge-98 (PyFunge) | befunge-98-pyfunge |
| Bit | bit |
| BitBitJump | bitbitjump |
| bitch | bitch |
| bitch (bit-h) | bitch-bith |
| bitch (shifty) | bitch-shifty |
| BitChanger | bitchanger |
| BitCycle | bitcycle |
| Bitwise | bitwise |
| Black (blak) | blak |
| Binary Lambda Calculus | blc |
| Boolfuck | boolfuck |
| Bot Engine | bot-engine |
| Brachylog v1 | brachylog |
| Brachylog | brachylog2 |
| Braille | braille |
| Brain-Flak | brain-flak |
| Brainbash | brainbash |
| brainbool | brainbool |
| BrainFlump | brainflump |
| brainfuck | brainfuck |
| Braingolf | braingolf |
| Brain-Flak (BrainHack) | brainhack |
| Brainlove | brainlove |
| BrainSpace | brainspace |
| Brian & Chuck | brian-chuck |
| Broccoli | broccoli |
| Bubblegum | bubblegum |
| Burlesque | burlesque |
| BuzzFizz | buzzfizz |
| Bitwise Fuckery | bwfuckery |
| Canvas | canvas |
| Cardinal | cardinal |
| Carol & Dave | carol-dave |
| Carrot | carrot |
| Cascade | cascade |
| Catholicon | catholicon |
| Cauliflower | cauliflower |
| Ceres | ceres |
| Chain | chain |
| Chef | chef |
| Changeling | changeling |
| Charcoal | charcoal |
| Check | check |
| Chip | chip |
| Cinnamon Gum | cinnamon-gum |
| CJam | cjam |
| Clam | clam |
| ,,, | commata |
| Commentator | commentator |
| Commercial | commercial |
| Condit | condit |
| Convex | convex |
| Cood | cood |
| Corea | corea |
| COW | cow |
| cQuents | cquents |
| Crayon | crayon |
| CSL | csl |
| Cubically | cubically |
| Cubix | cubix |
| Curlyfrick | curlyfrick |
| Cy | cy |
| D2 | d2 |
| Deadfish~ | deadfish- |
| Decimal | decimal |
| Del|m|t | delimit |
| Deorst | deorst |
| Dirty | dirty |
| Detour | detour |
| DOBELA | dobela |
| DOBELA (dobcon) | dobela-dobcon |
| Dodos | dodos |
| Dreaderef | dreaderef |
| Drive-In Window | drive-in-window |
| DStack | dstack |
| eacal | eacal |
| !@#$%^&*()_+ | ecndpcaalrlp |
| Element | element |
| ELVM-IR | elvm-ir |
| Emmental | emmental |
| Emoji | emoji |
| Emoji-gramming | emoji-gramming |
| Emojicode 0.5 | emojicode |
| Emojicode | emojicode6 |
| EmojiCoder | emojicoder |
| emotifuck | emotifuck |
| Emotinomicon | emotinomicon |
| (()) | empty-nest |
| Enlist | enlist |
| ESOPUNK | esopunk |
| ETA | eta |
| evil | evil |
| Explode | explode |
| Extended Brainfuck Type I | extended-brainfuck-type-i |
| ExtraC | extrac |
| face | face |
| FALSE | false |
| FerNANDo | fernando |
| FEU | feu |
| FIM++ | fimpp |
| ><> | fish |
| Fission | fission |
| Fission 2 | fission2 |
| Flipbit | flipbit |
| Floater | floater |
| Flobnar | flobnar |
| Foam | foam |
| Foo | foo |
| Forget | forget |
| Forked | forked |
| Forte | forte |
| Fourier | fourier |
| FRACTRAN | fractran |
| Fueue | fueue |
| Funciton | funciton |
| Functoid | functoid |
| Fynyl | fynyl |
| Gaia | gaia |
| Gaot++ | gaotpp |
| Geo | geo |
| Glypho | glypho |
| Glypho (shorthand) | glypho-shorthand |
| Gol><> | golfish |
| GolfScript | golfscript |
| Grass | grass |
| Grime | grime |
| GS2 | gs2 |
| hASM | hasm |
| Haystack | haystack |
| Half-Broken Car in Heavy Traffic | hbcht |
| Hyper-Dimensional Brainfuck | hdbf |
| Hexagony | hexagony |
| Hodor | hodor |
| Homespring | homespring |
| Hexadecimal Stacking Pseudo-Assembly Language | hspal |
| Husk | husk |
| I | i |
| iag | iag |
| Incident | incident |
| INTERCAL | intercal |
| JAEL | jael |
| J-uby | j-uby |
| Japt | japt |
| Jelly | jelly |
| Jellyfish | jellyfish |
| kavod | kavod |
| Keg | keg |
| Kipple (cipple) | kipple-cipple |
| Klein | klein |
| krrp | krrp |
| l33t | l33t |
| Labyrinth | labyrinth |
| Lean Mean Bean Machine | lmbm |
| LNUSP | lnusp |
| Locksmith | locksmith |
| Logicode | logicode |
| LOLCODE | lolcode |
| Lost | lost |
| LOWER | lower |
| Ly | ly |
| M | m |
| MachineCode | machinecode |
| Malbolge | malbolge |
| Malbolge Unshackled | malbolge-unshackled |
| MarioLANG | mariolang |
| Mascarpone | mascarpone |
| MathGolf | mathgolf |
| MATL | matl |
| Maverick | maverick |
| MaybeLater | maybelater |
| Memory GAP | memory-gap |
| MiLambda | milambda |
| Milky Way | milky-way |
| MineFriff | minefriff |
| Minimal-2D | minimal-2d |
| miniML | miniml |
| Minkolang | minkolang |
| Mirror | mirror |
| Momema | momema |
| Monkeys | monkeys |
| Moorhens | moorhens |
| Mornington Crescent | mornington-crescent |
| µ6 | mu6 |
| Muriel | muriel |
| MY | my |
| nameless language | nameless |
| Nandy | nandy |
| Nikud | nikud |
| Neim | neim |
| Neutrino | neutrino |
| Nhohnhehr | nhohnhehr |
| No | no |
| Noether | noether |
| NotQuiteThere | nqt |
| NTFJ (NTFJC) | ntfjc |
| Numberwang | numberwang |
| Oasis | oasis |
| ObCode | obcode |
| Ohm | ohm |
| Ohm v2 | ohm2 |
| OML | oml |
| oOo CODE | ooocode |
| Oration | oration |
| ORK | ork |
| Orst | orst |
| 05AB1E | osabie |
| Pain-Flak | pain-flak |
| Paradoc | paradoc |
| Parenthesis Hell | parenthesis-hell |
| Parenthetic | parenthetic |
| PATH | path |
| pbrain | pbrain |
| Phooey | phooey |
| Piet | piet |
| PingPong | pingpong |
| Pip | pip |
| Pixiedust | pixiedust |
| pl | pl |
| PostL | postl |
| Prelude | prelude |
| Premier | premier |
| Preproc | preproc |
| Purple | purple |
| Pushy | pushy |
| Puzzlang | puzzlang |
| Pyke | pyke |
| Pylons | pylons |
| PynTree | pyn-tree |
| Pyon | pyon |
| Pyramid Scheme | pyramid-scheme |
| Pyret | pyret |
| Pyt | pyt |
| Pyth | pyth |
| ??? | qqq |
| QuadR | quadr |
| Quadrefunge-97 (MTFI) | quadrefunge-97-mtfi |
| QuadS | quads |
| Quarterstaff | quarterstaff |
| Quintefunge-97 (MTFI) | quintefunge-97-mtfi |
| Rail | rail |
| Random Brainfuck | random-brainfuck |
| Re:direction | re-direction |
| Recursiva | recursiva |
| Reng | reng |
| ReRegex | reregex |
| res | res |
| ResPlicate | resplicate |
| Reticular | reticular |
| Retina 0.8.2 | retina |
| Retina | retina1 |
| RETURN | return |
| Rockstar | rockstar |
| ROOP | roop |
| Ropy | ropy |
| Rotor | rotor |
| RProgN | rprogn |
| RProgN 2 | rprogn-2 |
| Runic Enchantments | runic |
| Rutger | rutger |
| Sad-Flak | sad-flak |
| Sakura | sakura |
| Symbolic Brainfuck | sbf |
| Seed | seed |
| Septefunge-97 (MTFI) | septefunge-97-mtfi |
| Seriously | seriously |
| Sesos | sesos |
| Set | set |
| Sexefunge-97 (MTFI) | sexefunge-97-mtfi |
| ShapeScript | shapescript |
| shortC | shortc |
| Shove | shove |
| ;#+ | shp |
| Shtriped | shtriped |
| S.I.L.O.S | silos |
| Silberjoder | silberjoder |
| Simplefunge | simplefunge |
| Implicit | simplestack |
| Simplex | simplex |
| Sisi | sisi |
| /// | slashes |
| Self-modifying Brainfuck | smbf |
| smol | smol |
| Snails | snails |
| Snowman | snowman |
| SNUSP (Modular) | snusp |
| SNUSP (Bloated) | snusp-bloated |
| SNUSP (Snuspi) | snuspi |
| Somme | somme |
| Spaced | spaced |
| Shakespeare Programming Language | spl |
| Spoon | spoon |
| Stack Cats | stackcats |
| *><> | starfish |
| Starry | starry |
| Stax | stax |
| Stencil | stencil |
| Stones | stones |
| str | str |
| Straw | straw |
| Subskin | subskin |
| Sumerian | sumerian |
| SuperMarioLang | supermariolang |
| Super Stack! | superstack |
| Surface | surface |
| Swap | swap |
| Syms | syms |
| Symbolic Python | symbolic-python |
| TacO | taco |
| Tampio (functional) | tampio |
| Tampio (imperative) | tampioi |
| Tamsin | tamsin |
| TapeBagel | tapebagel |
| Taxi | taxi |
| Templates Considered Harmful | templates |
| Thing | thing |
| Threead | threead |
| Thue | thue |
| Thutu | thutu |
| Tidy | tidy |
| TinCan | tincan |
| tinyBF | tinybf |
| tinylisp | tinylisp |
| Tir | tir |
| TIS | tis |
| Toi | toi |
| Turing Machine But Way Worse | tmbww |
| TRANSCRIPT | transcript |
| Trefunge-97 (MTFI) | trefunge-97-mtfi |
| Trefunge-98 (PyFunge) | trefunge-98-pyfunge |
| Triangular | triangular |
| Triangularity | triangularity |
| Trigger | trigger |
| Triple Threat | triple-threat |
| TrumpScript | trumpscript |
| Turtlèd | turtled |
| Underload | underload |
| Unefunge-97 (MTFI) | unefunge-97-mtfi |
| Unefunge-98 (PyFunge) | unefunge-98-pyfunge |
| Unicat | unicat |
| Unlambda | unlambda |
| Uno | uno |
| Unreadable | unreadable |
| V (vim) | v |
| V (FMota) | v-fmota |
| VAR | var |
| Verbosity | verbosity |
| Verbosity v2 | verbosity2 |
| Versert | versert |
| Vitsy | vitsy |
| The Waterfall Model | waterfall |
| Whirl | whirl |
| Whispers v1 | whispers |
| Whispers v2 | whispers2 |
| Whitespace | whitespace |
| Width | width |
| Wierd (John's) | wierd |
| Wise | wise |
| Woefully | woefully |
| wsf | wsf |
| Wumpus | wumpus |
| W.Y.A.L.H.E.I.N. | wyalhein |
| xEec | xeec |
| xeraph | xeraph |
| YABALL | yaball |
| yup | yup |
| Z80Golf | z80golf |
In your code:
import tio from 'tio.js'Evaluating a code
const response = await tio('console.log("Hello, World!");')
console.log(response)
// =>
// {
// output: 'Hello, World!\n',
// timedOut: false,
// realTime: 0.069,
// userTime: 0.069,
// sysTime: 0.069,
// CPUshare: 99.99,
// exitCode: 0
// }Evaluating a code from another programming language
let response = await tio('print("Hello, World!")', {
language: 'python3'
})
console.log(response)
// =>
// {
// output: 'Hello, World!\n',
// timedOut: false,
// realTime: 0.069,
// userTime: 0.069,
// sysTime: 0.069,
// CPUshare: 99.99,
// exitCode: 0
// }
// tio.js uses 'javascript-node' by default.
tio.defaultLanguage = 'python3'
response = await tio('print("Hello, World!")')
console.log(response)
// =>
// {
// output: 'Hello, World!\n',
// timedOut: false,
// realTime: 0.069,
// userTime: 0.069,
// sysTime: 0.069,
// CPUshare: 99.99,
// exitCode: 0
// }Surpressing infinite loops with timeouts
// make the response timeout after 10000 ms (10 seconds).
let response = await tio('for (;;);', {
timeout: 10000
})
console.log(response)
// =>
// {
// output: 'Request timed out after 10000ms',
// timedOut: true,
// realTime: 10,
// userTime: 10,
// sysTime: 10,
// CPUshare: 0,
// exitCode: 0
// }
// tio.js uses Infinity (no timeouts) by default.
tio.defaultTimeout = 10000
response = await tio('for (;;);')
console.log(response)
// =>
// {
// output: 'Request timed out after 10000ms',
// timedOut: true,
// realTime: 10,
// userTime: 10,
// sysTime: 10,
// CPUshare: 0,
// exitCode: 0
// }Passing in extra compiler flags
// this only works in compiled languages. (e.g rust)
const code = `
fn main() {
#[cfg(feature = "something")]
println!("this will be printed");
}
`
// compiled as 'rustc code.rs --cfg feature="something"'
let response = await tio(code, {
language: 'rust',
cflags: ['--cfg', 'feature="something"']
})
console.log(response)
// =>
// {
// output: 'this will be printed\n',
// timedOut: false,
// realTime: 0.069,
// userTime: 0.069,
// sysTime: 0.069,
// CPUshare: 99.99,
// exitCode: 0
// }
// tio.js uses [] (no extra compiler flags) by default.
tio.defaultCflags = ['--cfg', 'feature="something"']
response = await tio(code, {
language: 'rust'
})
console.log(response)
// =>
// {
// output: 'this will be printed\n',
// timedOut: false,
// realTime: 0.069,
// userTime: 0.069,
// sysTime: 0.069,
// CPUshare: 99.99,
// exitCode: 0
// }Passing in command-line arguments
let response = await tio('console.log(process.argv.slice(2).join(", "))', {
argv: ['Hello', 'World!']
})
console.log(response)
// =>
// {
// output: 'Hello, World!\n',
// timedOut: false,
// realTime: 0.069,
// userTime: 0.069,
// sysTime: 0.069,
// CPUshare: 99.99,
// exitCode: 0
// }
// tio.js uses [] (no command-line arguments) by default.
tio.defaultArgv = ['Hello', 'World!']
response = await tio('console.log(process.argv.slice(2).join(", "))')
console.log(response)
// =>
// {
// output: 'Hello, World!\n',
// timedOut: false,
// realTime: 0.069,
// userTime: 0.069,
// sysTime: 0.069,
// CPUshare: 99.99,
// exitCode: 0
// }If you want to support this project, consider donating! ❤