GoCode Language - Owen2k6/GoOS GitHub Wiki
GoCode is line-based. Each line is parsed by prefix keys like string
, int
, if=
, window=
, button=
, etc. Tabs (\t
) at the start of a line define nesting level for conditional execution.
- One statement per line.
-
Tabs control blocks: when an
if=
condition is true, the interpreter enables the next tab level (expectedLevel = currentLevel + 1
) so lines indented by one more tab will run. - Spaces are not used for indentation; only real tab characters are counted.
- Values are parsed very literally; prefer the documented formats below.
-
Variables
-
string name = value
orstring=name=value
-
int name = 123
orint=name=123
bool=name=true|false
-
-
Console I/O
print="literal" + var + "more"
println="literal" + var + "more"
-
input=
(prompt from previouswrite
/print
) orinput=Prompt text
-
Flow
-
if=<expr>
(see comparisons below; negation asif=!A==B
) -
goto=<lineNumber>
(1‑based) sleep=<milliseconds>
-
stop=
orstop=Prompt
(waits for key)
-
-
Windows & UI
window=Name=width=height
button=ParentWindow=ButtonName=width=height=x=y=clickLine
-
Persistence
-
regprog=ProgramName
(must be called once before save/load) save=varName
load=varName
-
-
Colours
frontcolor=<name>
backcolor=<name>
The interpreter supports:
-
A < B
,A <= B
,A > B
,A >= B
for integers (either numeric literals or integer variables). -
A == B
for strings or integers. If either side is a known string variable or quoted, a string comparison is performed; otherwise an integer comparison is attempted. - Negation form:
if=!A==B
(interpreted as “not (A == B)”).
Important: if=
controls the next tab level only. Example:
if=score>10
println="Passed"
println="Always runs"
The println="Passed"
executes only if score>10
. Everything at the same level as if=
continues normally.