ThingLangOOP

From Esolang
Jump to navigation Jump to search

ThingLangOOP is a Object Oriented version of ThingLang made by User:Intiha that was inspired by ThingLang, which was made by User:Rasa8877. It combines a compiler and runner in a single file, fully compatible with TCC. Supports variable assignment, printing, loops, events, and comments.

Overview

Commands / Keywords

  • THIS <name> IS <value> ─ Assign a value (number or string) to a variable.
  • PRINT <value_or_variable> ─ Print the value of a variable or a string literal.
  • NOTAGAIN <n> ... TIMESEND ─ Loop the block <n> times.
  • TRIGGER <EventName> ─ Trigger a registered event.
  • ! ─ Comment; anything after ! on a line is ignored.

Example Program

```THIS counter IS 0 THIS name IS "Intiha"

PRINT "Starting program..."

NOTAGAIN 3 PRINT "Outer loop iteration" NOTAGAIN 2 PRINT " Inner loop iteration" THIS counter IS counter + 1 TIMESEND TIMESEND

PRINT "Counter after loops:" PRINT counter

! Event demonstration TRIGGER LowHealth```

Bytecode Compilation

  • -compile=file.tlo → generates file.tloc
  • -run=file.tlo/.tloc → executes program

Opcodes

0x01 → SET_VAR 0x02 → PRINT 0x03 → CALL_EVENT 0x04 → LOOP 0xFF → BLOCK_END

Limitations

  • Functions are not implemented
  • Loops are single-level only in bytecode
  • Variables are stored as strings
  • Arithmetic beyond assignment is limited; expressions like counter + 1 are not fully parsed in runner

Compatibility

  • Works with TCC
  • Single-file, portable, no external dependencies

C implementation

github