Compile API

Technically, it is possible to implement a parser (which is already done in the syntax highlighting module of code editor!) and corresponding code generation module in TypeScript to transform C0 to BC0 on browser.

However, to control the scale of this project, we decided to use the cc0 compiler with -b to do this instead. We've set up a server to provide a Compile API for the frontend browser to call on.

Compile C0 code into BC0 byte code

POST URL: ...(backend not deployed on public server yet)/compile

Accept multiple C0 source code files and

On Success: response with a compiled BC0 byte code file.

On Failure: response with empty BC0 byte code and return the standard output from cc0 compiler.

Query Parameters

NameTypeDescription

dyn_check*

boolean

Apply Dynamic Contract Check (-d flag in CC0) or not

Request Body

NameTypeDescription

filenames*

String[]

List of file names

codes*

String[]

Content (source codes) in each file, must have same length and order as filenames

{
    "bytecode": string,    // Empty when compile failed
    "error": string        // Empty when compile successed
}

Last updated