Install the compiler
Requirements
Section titled “Requirements”The compiler is a JavaScript program. Node.js 18 or a later version runs it.
Installation
Section titled “Installation”Install the compiler from npm:
npm install -g ranger-compilerThe command rgrc is then available.
The compiler uses the MIT license. See Licenses.
Command line
Section titled “Command line”The compiler reads one source file and writes one output file:
rgrc program.rgr -l=go -d=./bin -o=program.go| Option | Function |
|---|---|
-l=<target> |
The target language. One of es6, go, scala, java7, swift3, swift6, kotlin, dart, cpp, php, csharp, python, rust. |
-d=<directory> |
The output directory. The default is bin/. |
-o=<file> |
The output file. The default is output.<extension>. |
-typescript |
Write JavaScript with TypeScript annotations. |
-nodemodule |
Export the classes as CommonJS modules. |
-esm |
Export the classes as ES6 modules. |
-sourcemap |
Write a source map with the JavaScript or the TypeScript output. |
-strict |
Do not read an optional value automatically outside of a try block. |
-strict-ownership |
Print the inferred ownership of each function parameter and the per-class sharing verdict. See Ownership and lifetime. |
-rust-value-classes |
Rust only: emit every class as a plain value struct. By default a class the compiler proves shared becomes Rc<RefCell<T>> so that objects share on Rust the way they do on every other target; this flag restores the old all-value model. See Memory management. |
-operatordoc=<file> |
Write the operator table into a Markdown file. |
-classdoc=<file> |
Write the class documentation into a Markdown file. |
-apidoc=<dir> |
Write the API artifacts (api.json, api.md) built from the doc { … } blocks into that subdirectory. |
-apiformat=<list> |
Which API artifacts to write: json, markdown, report. Default json,markdown. |
-apipackage |
Also write the packaging the target ecosystem expects: package.json for npm, .csproj and docfx.json for NuGet, build.gradle.kts for Gradle and Dokka, Package.swift and a .docc catalog for SwiftPM, pyproject.toml and __all__ for pip, pubspec.yaml and a generated export … show library for pub. |
-csnamespace=<name> |
The C# namespace for the generated types. |
-ktpackage=<name> |
The Kotlin package for the generated types. |
-apistrict |
An undocumented public declaration or parameter is an error, not a warning. |
-keep-examples |
Emit the functions named by an example doc entry. They are type checked either way; by default they are left out of the output. |
To see the complete list, run rgrc with no arguments.
Compile without an installation
Section titled “Compile without an installation”The playground compiles Ranger in the browser. It needs no installation. Open the playground and write the program in the editor.
Ranger 3.5.1 · commit f323fd4 · development build