ESOTERIC STANDARD COMMITTEE Esopreter ESOSC-2014-D8 This standard has not been submitted for approval yet. 1 Esopreter ----------- Esopreter is a standardized API based on the HTTP protocol. The API allows executing programs in a specified language with a given input to obtain the corresponding output. 2 API ----- The API was designed to be as simple as possible. An end user or service only has to do a simple POST request with a content type "application/x-www-form-urlencoded" and the post parameters "language", "program" and "input". The server will respond with a response with content type "application/json" and containing the output and possible errors of the program. In most cases output will contain stdout and error will contain stderr where program input is fed through stdin. "language" contains the language identifier [Sect. 4]. Given below is an example request [example_request] and an example response [example_response]: [example_request] POST HTTP/1.1 Host: Content-Type: application/x-www-form-urlencoded Content-Length: 51 program=%2B%2B%5B-%5D&input=data&language=brainfuck [/example_request] [example_response] HTTP/1.1 200 OK Content-Length: 37 Content-Type: application/json {"output":"Hello, world!","error":"",cause:null} [/example_response] 2.1 Responses ============= If the program can't be run (due to syntax or other compile time errors) the status code must be set to "200" and "error" in the returned json must contain the error information and "cause" must be set to either "SYNTAX ERROR" or "COMPILER ERROR". If the program exceeds a limit such as cpu time, memory usage or size of output the status code should be set to "200" and "cause" must be set to one of the following strings: - "OUT OF MEMORY": In case the program exceeded memory limits. - "TIMEOUT": In case the program did not terminate within an expected time window. - "OUTPUT TOO LARGE": If output has become too large. Servers should send output that was produced before a limit was exceeded to the clients. If the server does not support the language the status code must be set to "200" and cause set to "LANGUAGE NOT SUPPORTED". If the program attempts to do an operation prohibited by the server (such as creating files, opening ports etc.) status code must be set to "200" and "cause" to "OPERATION NOT SUPPORTED". In every other case status code must be set to "200" as well and "cause" must be set to null. 3 List of Esopreters -------------------- The ESOSC manages a list of servers by language which support the Esopreter API. Everybody is free to request a server to be included in the list given the following requirements are met: * Server must be online almost all of the time * Server must offer at least one programming language * Server must follow the Esopreter specification * Server needs to use an interpreter/compiler that follows the programming language's specification. * Server must support HTTP/1.1 and be available under port 80 (or 443 if https is supported). HTTPS support is optional. 4 Language identifiers ---------------------- The ESOSC manages a list of language identifiers. In case a language has no clear specification or no universally agreed upon interpretation of the specification ESOSC will create dedicated language identifiers for different versions of the same language. Such language identifiers have the format , [ '/', ] options :=