2 Star 0 Fork 2

你耀世璀璨 / riju

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Riju

Riju is a very fast online playground for every programming language. In less than a second, you can start playing with a Python interpreter or compiling INTERCAL code.

Check out the live application!

You should not write any sensitive code on Riju, as NO GUARANTEES are made about the security or privacy of your data. (No warranty etc etc.)

This project is a work in progress, and I don't intend on thoroughly documenting it until it has reached feature-completeness.

Criteria for language inclusion

I aspire for Riju to support more languages than any reasonable person could conceivably think is reasonable. That said, there are some requirements:

  • Language must have a clear notion of execution. This is because a core part of Riju is the ability to execute code. Languages like YAML, SCSS, and Markdown are fine because they have a canonical transformation (into JSON, CSS, and HTML respectively) that can be performed on execution. However, languages like JSON, CSS, and HTML are not acceptable, because there's nothing reasonable to do when they are run.
  • Language must not require input or configuration. This is because, in order to avoid bloating the interface, Riju provides a way to supply code but not any other data. Of course, it's possible to supply input interactively, so reading stdin is allowed, but if a language can only reasonably be programmed with additional input, it's not a candidate for inclusion. Thus, many templating languages are excluded, since they don't do anything unless you are substituting a value. However, some languages such as Pug are allowed, because they implement a significant syntax transformation outside of template substitution. Also, languages like Sed and Awk are allowed, because it's straightforward to test code written in them even without a pre-prepared input file.
  • Language must not require a graphical environment. This is because we use a pty to run code, and there is no X forwarding. As such, we can't use languages like Scratch, Alice, and Linotte.
  • Language must be available for free under a permissive license. This is because we must download and install all languages noninteractively in the Docker image build, so anything that requires license registration is unlikely to work (or be legal). We can't use Mathematica or MATLAB, for example, but we can use Mathics and Octave, which provide compatible open-source implementations of the underlying languages.
  • Language must be runnable under Docker on Linux. This is because that's the execution environment we have access to. AppleScript is out because it only runs on macOS, and Docker is out because it can't be run inside Docker (without the --privileged flag, which has unacceptable security drawbacks; see #29). Note, however, that many Windows-based languages can be used successfully via Mono or Wine, such as Cmd, C#, and Visual Basic.

Here are some explicit non-requirements:

  • Language must be well-known. Nope, I'll be happy to add your pet project; after all, Kalyn and Ink are already supported.
  • Language must be useful. I would have no objection to adding everything on the esolangs wiki, if there are interpreters/compilers available.
  • Language must be easy to install and run. Well, it would be nice, but I've seen some s*** when adding languages to Riju so it will take a lot to surprise me at this point.

If you'd like to request a new language, head to the language support meta-issue and add a comment. Of course, if you actually want it to be added anytime soon, you should submit a pull request :)

Project setup

To run the webserver, all you need is Yarn. Just run yarn install as usual to install dependencies. For production, it's:

$ yarn backend    |- or run all three with 'yarn build'
$ yarn frontend   |
$ yarn system     |
$ yarn server

For development with file watching and automatic server rebooting and all that, it's:

$ yarn backend-dev    |- or run all four with 'yarn dev'
$ yarn frontend-dev   |
$ yarn system-dev     |
$ yarn server-dev     |

The webserver listens on localhost:6119. Now, although the server itself will work, the only languages that will work are the ones that happen to be installed on your machine. (I'm sure you can find a few that are already.) Also, sandboxing using UNIX filesystem permissions will be disabled, because that requires root privileges. If you want to test with all the languages plus sandboxing (or you're working on adding a new language), then you need to use Docker. Running the app is exactly the same as before, you just have to jump into the container first:

$ make docker

Note that building the image typically requires over an hour and 20 GB of disk space, and it is only growing.

The above command generates the development image as a subroutine. You can skip this and use the last tagged development image:

$ make docker-nobuild

Or you can explicitly build the image without running it:

$ make image-dev

The production image is based on the development one, with some additional layers. You can build it as follows:

$ make image-prod

Lastly I should mention the tests. There are integration tests for every language, and they can be run as follows:

$ [CONCURRENCY=2] [TIMEOUT_FACTOR=1] yarn test [<filter>...]

Filters can be for language (python, java) or test type (hello, lsp). You can comma-delimit multiple filters to do a disjunction, and space-delimit them to do a conjunction (yarn test hello python,java for the hello tests for python and java).

The tests are run automatically when building the production image, and fail the build if they fail.

See also riju-cdn.

Flag

Flag

# MIT License Copyright (c) 2020 Radon Rosborough Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

A playground for every programming language 展开 收起
TypeScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/niyaoshicuican_admin/riju.git
git@gitee.com:niyaoshicuican_admin/riju.git
niyaoshicuican_admin
riju
riju
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891