GSET
Language Guide

Language Overview

The GSET language — syntax, keywords, and the implemented subset.

The GSET language is a small, procedural language with C-family braces and Python-family print. This guide covers the implemented subset — everything you can reliably write today and run on at least one target.

Keywords and syntax families

KindGSET keyword(s)
Variable declarationvar, val, let, const (four spellings, one meaning)
Printprint, plus config aliases like say, shout, echo, log, puts
Branchingif, elif / else if, match/case/default, switch
Loopsfor, foreach / for … in, while, do … while
Functionsfunction, fn, def, lambdas (x) => x * 2
Error handlingtry, catch, finally, throw / raise
Collectionsarrays [1, 2, 3], maps {"name": "Ada"}, sets {1, 2, 3}
Classesclass (partial — see Classes)
Modulesimport, export (parsed, not yet emitted)

Aliases are runtime-configurable. say becomes print in Python, console.log in JavaScript, fmt.Println in Go. See Configuration.

Hello world, all targets

print("Hello, GSET!")
TargetGenerated line
Pythonprint("Hello, GSET!")
JavaScriptconsole.log("Hello, GSET!")
Gofmt.Println("Hello, GSET!")
JavaSystem.out.println("Hello, GSET!")
Rubyputs("Hello, GSET!")

The implemented subset in one file

var name = "Ada"
var scores = {"Ada": 90, "Grace": 85}
foreach name2, score in scores {
    if score > 86 {
        print(name2, "passes")
    } else {
        print(name2, "needs review")
    }
}

This runs on go, python, and javascript targets today.

How to read the examples in this guide

Every example shows:

  1. GSET source, and
  2. the output for one or two targets.

The targets that compile and run are labeled per Portability. Anything marked Planned (like full class methods or Go try) will produce an error today — the parser stops with a clear message instead of hanging.

Feature status summary

FeatureStatus
Variables, arrays, maps, index access, foreachImplemented
if/elif/else, match/case, switchImplemented
while, do-while, for, for…inImplemented
Functions, return, lambdasImplemented
try/catch/finally, throwImplemented (Python, JS, Ruby)
List comprehensionsImplemented (Python, JS, Go, Ruby)
ClassesPartial — shell emitted, method bodies not yet generated
import / export / modulesPlanned — parsed but not emitted

Next

  • Variables — declarations, assignment, and the "var first" rule for Go

On this page