GSET
Targets

Targets Overview

Which backends exist, how target selection works, and how the emitters differ.

GSET ships five working backends — go, python, javascript, java, ruby — plus config stubs for future targets.

How the target is chosen

Two rules:

  1. File extension picks the default — foo.py defaults to Python, foo.js to JavaScript, foo.gset/unknown to Go.
  2. --target always wins — it overrides the extension default.
FlagValues
--targetgo, python, js/javascript, java, ruby

Unknown targets are rejected with a clear message. Emitted temp files use the extension map: .go, .py, .js, .java, .rb.

Backend table

TargetStatusrun needs installedNotes
PythonImplementedpython3Most faithful subset coverage
JavaScriptImplementednodeconsole.log, const, arrow lambdas
GoImplementedgoDefault IR, func main() wrapper, needs typed values
JavaImplementedjava + javacWrites Main.java, one class per file
RubyImplementedrubyputs, begin/rescue/ensure
C, C++, C#, Rust, PHP, Swift, Kotlin, TypeScriptPlanned—Config stubs exist, no emitter yet

What a "working backend" means

gset run foo.gset --target python does four things, all verified:

  1. Parses your GSET source.
  2. Emits a complete, runnable file — wrapper (package main, class Main, shebang-free script) included.
  3. Writes it to a location the target runtime expects.
  4. Executes the target's compiler/interpreter and streams output.

gset transpile does steps 1–2 and prints the file to stdout, or -o file saves it.

The five outputs of one program

var name = "World"
print("Hello, " + name)
TargetGenerated
--target gopackage main / import "fmt" / func main() / fmt.Println("Hello, " + name)
--target pythonname = "World" / print("Hello, " + name)
--target javascriptlet name = "World"; / console.log("Hello, " + name)
--target javapublic class Main { / String name = "World"; / System.out.println(...)
--target rubyname = "World" / puts("Hello, " + name)

Comparing targets

Each target page documents the same three things:

  1. What runs cleanly — the verified subset for that runtime.
  2. What compiles but behaves differently — e.g. Go's array printing format, Python floordiv differences.
  3. What doesn't compile yet — e.g. try on Go, methods on Ruby.

Pick your target by asking "what must genuinely run at the end?" — Python/JS are the safest for dynamically-typed GSET; Go/Java require typed annotations; Ruby is a near-Python port with puts.

On this page