GSET
Language Guide

Operators

Arithmetic, comparison, and logical operators in GSET.

Implemented

GSET operators map onto the common subset shared by all five targets.

Arithmetic

GSETPythonJavaScriptGo
++++
----
****
////
%%%%
** (power)**Math.powmath.Pow
unary -x-x-x-x
var a = 10
var b = 3
print(a + b)
print(a * b)
print(a - b * 2)
print(a ** 2)

Python and JavaScript run this unchanged. Go needs typed ints — annotate or wrap in functions (see the var-first rule).

Comparison and logic

GSETPythonJavaScriptGo
======= (emitted as ===? No — see note)==
!=!=!== note!=
<, >, <=, >=samesamesame
&&and&&&&
||or||||
!not!!

Note on ===: the JavaScript emitter currently produces ==/!=, not strict equality. For string/number comparisons this is fine; for type-sensitive checks prefer narrower GSET code.

var age = 17
if age >= 18 && age < 65 {
    print("adult")
} else if !(age >= 18) {
    print("minor")
}

Bitwise and shifts

&, |, ^, <<, >> map to the corresponding operators in every target. They are most useful when your code is already integer-typed (e.g., the Go target).

String concatenation

+ concatenates strings in every target, and works alongside print's variadic behavior:

var name = "World"
print("Hello, " + name)
print(1, "and", true)
TargetOutput for print(1, "and", true)
Python1 and True
JavaScript1 and true

Ternary

A ? : collects to if/else in Python, condition ? a : b in C-family targets:

var status = age >= 18 ? "adult" : "minor"

Operator precedence

GSET follows C-family precedence: unary → ** → * / % → + - → shifts → comparisons → equality → & | ^ → && → || → ternary → assignment. Parentheses are always allowed and emitted verbatim.

On this page