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
| Kind | GSET keyword(s) |
|---|---|
| Variable declaration | var, val, let, const (four spellings, one meaning) |
print, plus config aliases like say, shout, echo, log, puts | |
| Branching | if, elif / else if, match/case/default, switch |
| Loops | for, foreach / for … in, while, do … while |
| Functions | function, fn, def, lambdas (x) => x * 2 |
| Error handling | try, catch, finally, throw / raise |
| Collections | arrays [1, 2, 3], maps {"name": "Ada"}, sets {1, 2, 3} |
| Classes | class (partial — see Classes) |
| Modules | import, export (parsed, not yet emitted) |
Aliases are runtime-configurable.
saybecomesconsole.login JavaScript,fmt.Printlnin Go. See Configuration.
Hello world, all targets
print("Hello, GSET!")| Target | Generated line |
|---|---|
| Python | print("Hello, GSET!") |
| JavaScript | console.log("Hello, GSET!") |
| Go | fmt.Println("Hello, GSET!") |
| Java | System.out.println("Hello, GSET!") |
| Ruby | puts("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:
- GSET source, and
- 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
| Feature | Status |
|---|---|
| Variables, arrays, maps, index access, foreach | Implemented |
| if/elif/else, match/case, switch | Implemented |
| while, do-while, for, for…in | Implemented |
| Functions, return, lambdas | Implemented |
| try/catch/finally, throw | Implemented (Python, JS, Ruby) |
| List comprehensions | Implemented (Python, JS, Go, Ruby) |
| Classes | Partial — shell emitted, method bodies not yet generated |
| import / export / modules | Planned — parsed but not emitted |
Next
- Variables — declarations, assignment, and the "var first" rule for Go