mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-07-16 17:26:58 -04:00
This adds support for [RazorForge](https://github.com/dj-lumiere/razorforge-suflae), a precision-focused, ahead-of-time compiled language that lowers to LLVM IR. It follows `docs/AddingALanguage.md`. ### What's included - `lib/languages.ts` — language definition (`.rf`, Monaco mode `razorforge`, disassembly `llvm-ir`) - `types/languages.interfaces.ts` — `razorforge` language key - `lib/compilers/razorforge.ts` + `lib/compilers/_all.ts` — compiler driver - `static/modes/razorforge-mode.ts` + `static/modes/_all.ts` — Monarch syntax highlighting - `etc/config/razorforge.{defaults,amazon}.properties` — compiler config - `examples/razorforge/default.rf` — default example - `.github/labeler.yml` — `lang-razorforge` label ### Compiler behavior RazorForge's CLI takes verbs + positional arguments only (all build config lives in `razorforge.toml`, not flags). The driver invokes the `build` verb, which runs semantic analysis and code generation and writes LLVM IR next to the source (`example.rf` → `example.ll`) without invoking `opt`/`clang`. The primary output is the emitted LLVM IR, so `supportsIrView` is on and `supportsExecute` is off for now. ### Notes - Install recipe: compiler-explorer/infra#2177 - No logo yet (`logoFilename: null`); happy to add one in a follow-up. - Verified locally: `make`, `biome check`, `tsc`, and `vitest related` all pass; the example compiles to valid LLVM IR with the released `v0.0.3-alpha` build.
17 lines
460 B
Plaintext
17 lines
460 B
Plaintext
module Example
|
|
import IO/Console
|
|
|
|
# `!` marks a failable routine. The compiler auto-generates try_/check_/lookup_
|
|
# variants, so callers choose how to consume failure - no exceptions involved.
|
|
routine get_text!(n: S64) -> Text
|
|
when n
|
|
== 0 => throw DivisionByZeroError()
|
|
== 1 => return "hello"
|
|
else => return "world"
|
|
|
|
routine start()
|
|
var m = try_get_text(n: 0)
|
|
when m
|
|
is None => show("absent")
|
|
else v => show(f"present: {v}")
|
|
return |