RAPID
  • Introduction
  • Quick start
  • Resources
    • Debugging
    • Compiler
    • Rapid CLI
    • Project structure
  • Language
    • Types [proposal]
    • Variables [proposal]
    • Functions
  • Sources
    • Github
Powered by GitBook
On this page
  • Installation
  • Example usage
  • API

Was this helpful?

  1. Resources

Compiler

Create ready to use binary from source files

PreviousDebuggingNextRapid CLI

Last updated 5 years ago

Was this helpful?

Installation

With NPM:

$ npm i @rapid-lang/compiler -g

To run compiler you will need Node 12 or newer. Go to to get installation files.

and works on OS X, Windows and Linux.

Example usage

Compiles file.rapid and outputs app.wasm with sourcemaps ready to be run in browser.

$ rapid-compiler file.rapid -o app.wasm -s
function main(): int {
  return 12
}
(module
 (type $none_=>_i32 (func (result i32)))
 (export "main" (func $main))
 (func $main (; 0 ;) (; has Stack IR ;) (result i32)
  ;;@ file.rapid:2:1
  (i32.const 12)
 )
)
func (result i32)
  i32.const 12
end

API

Commands:
  index.js source  Path to source file to be compiled

Options:
  -o, --output      Path to result file to be saved          [string] [required]
  -h, --help        Show help                                          [boolean]
  -v, --version     Show version number                                [boolean]
  -s, --sourceMaps  Generate sourceMaps for debugging                  [boolean]
  -t, --textFormat  Generate WebAssembly Text Format (wat) file         [string]
  -p, --port        Sourcemaps default port                             [number]
https://nodejs.org/en/download/
Rapid Compiler
Rapid CLI