GoCode Language - Owen2k6/GoOS GitHub Wiki

Language & Lexicon

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.

General rules

  • 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.

Statements overview

  • Variables
    • string name = value or string=name=value
    • int name = 123 or int=name=123
    • bool=name=true|false
  • Console I/O
    • print="literal" + var + "more"
    • println="literal" + var + "more"
    • input= (prompt from previous write/print) or input=Prompt text
  • Flow
    • if=<expr> (see comparisons below; negation as if=!A==B)
    • goto=<lineNumber> (1‑based)
    • sleep=<milliseconds>
    • stop= or stop=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>

Comparisons in if=

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.

⚠️ **GitHub.com Fallback** ⚠️