GSET
Getting Started

Quick Start

Write your first GSET program, transpile it, and run it.

Implemented

This page is a task-oriented tour. You will install → create → transpile → run.

1. Install

Install GSET (go build -o gset . if you cloned the repo), then confirm:

gset version      # GSET v2.2.1
gset help

2. Create a file

Create hello.gset:

print("Hello, GSET!")

3. Transpile

See the generated source without running it:

$ gset transpile hello.gset
package main

func main() {
    fmt.Println("Hello, GSET!")
}

.gset files default to the Go target. Pick another target explicitly:

$ gset transpile hello.gset --target python
print("Hello, GSET!")

$ gset transpile hello.gset --target javascript
console.log("Hello, GSET!")

Save output to a file with -o:

gset transpile hello.gset --target js -o hello.js

4. Run

$ gset run hello.gset
Hello, GSET!

gset run transpiles and executes with the target toolchain in one step. Because hello.gset is a .gset file it runs on the Go target by default.

5. Choice of target — when to use --target

GSET decides the target from the file extension, unless you pass --target:

Input fileImplied targetOverride example
hello.gsetGo (the default IR)gset run hello.gset --target python
hello.pyPythongset run hello.py --target go
hello.jsJavaScript—
hello.javaJava—
hello.rbRuby—
hello.goGo—

So the file extension does not force the output language — it only picks the default. --target always wins.

6. A slightly bigger program

Count down from a variable, plus a loop and a string concatenation:

var name = "World"
var count = 3
print("Hello, " + name)
while count > 0 {
    print(count)
    count = count - 1
}
$ gset run hello.gset --target python
Hello, World
3
2
1

$ gset run hello.gset --target javascript
Hello, World
3
2
1

The same program runs unchanged on go, python, javascript, java, and ruby targets. See Portability.

What if something fails?

  • Parse error → GSET prints the offending lines before running anything.
  • Transpile error → you asked for a target that has no emitter (--target c).
  • Execution error → the target toolchain (e.g. Python) rejected the generated code, or the runtime isn't installed.

Diagnosing these is covered in Errors.

Next steps

On this page