Skip to content

Keywords Reference

Complete reference of all keywords in HypnoScript based on the Rust implementation.

Program Structure

KeywordDescriptionExample
FocusProgram start (required)Focus { ... } Relax
RelaxProgram end (required)Focus { ... } Relax
entranceInitialization block (optional)entrance { observe "Start"; }
finaleCleanup/destructor block (optional)finale { observe "End"; }
deepFocusExtended if block with deeper scopeif (x > 5) deepFocus { ... }

Variable Declarations

KeywordDescriptionMutabilityExample
induceStandard variable declarationMutableinduce x: number = 42;
implantAlternative variable declarationMutableimplant y: string = "text";
freezeConstant declarationImmutablefreeze PI: number = 3.14159;
anchorCreate state snapshot/backupImmutableanchor saved = currentValue;
fromInput source specification-induce x: number from external;
externalExternal input source-induce name: string from external;

Control Structures

KeywordDescriptionEquivalentExample
ifConditional statementifif (x > 5) { ... }
elseAlternative branchelseif (x > 5) { ... } else { ... }
whileWhile loopwhilewhile (x > 0) { x = x - 1; }
loopFor-like loopforloop (induce i = 0; i < 10; i = i + 1) { ... }
snapBreak loopbreakwhile (true) { snap; }
sinkContinue to next iterationcontinuewhile (x < 10) { sink; }
sinkToGoto (jump to label)gotosinkTo myLabel;
oscillateToggle boolean variable-oscillate isActive;

Note: break and continue are also accepted as synonyms for snap and sink.

Functions

KeywordDescriptionExample
suggestionFunction declarationsuggestion add(a: number, b: number): number { ... }
triggerEvent handler/callback functiontrigger onClick = suggestion() { ... };
imperativeSuggestionImperative function (modifier)imperativeSuggestion doSomething() { ... }
dominantSuggestionStatic function (modifier)dominantSuggestion helperFunc() { ... }
awakenReturn statementawaken x + y;
callExplicit function callcall myFunction();

Note: return is also accepted as a synonym for awaken.

Object-Orientation

Sessions (Classes)

KeywordDescriptionExample
sessionClass declarationsession Person { ... }
constructorConstructor methodsuggestion constructor(name: string) { ... }
exposePublic visibilityexpose name: string;
concealPrivate visibilityconceal age: number;
dominantStatic memberdominant counter: number = 0;

Structures

KeywordDescriptionExample
tranceifyRecord/struct declarationtranceify Point { x: number; y: number; }

Input/Output

KeywordDescriptionBehaviorExample
observeStandard outputWith newlineobserve "Hello World";
whisperOutput without newlineWithout newlinewhisper "Part1"; whisper "Part2";
commandImperative outputUppercase, with newlinecommand "Important!";
driftPause/sleepDelay in msdrift(2000);

Modules and Globals

KeywordDescriptionExample
mindLinkImport/includemindLink "utilities.hyp";
sharedTranceGlobal variablesharedTrance config: string = "global";
labelLabel declarationlabel myLabel;

Data Types

KeywordDescriptionExample
numberNumeric typeinduce x: number = 42;
stringString typeinduce text: string = "hello";
booleanBoolean typeinduce flag: boolean = true;
tranceSpecial trance typeinduce state: trance;

Literals

KeywordDescriptionExample
trueBoolean literalinduce isActive: boolean = true;
falseBoolean literalinduce isActive: boolean = false;

Testing/Debugging

KeywordDescriptionExample
assertAssertionassert x > 0;

Hypnotic Operators

Comparison Operators

HypnoticStandardMeaning
youAreFeelingVerySleepy==Equal
youCannotResist!=Not equal
lookAtTheWatch>Greater
fallUnderMySpell<Less
yourEyesAreGettingHeavy>=Greater-or-equal
goingDeeper<=Less-or-equal

Legacy Operators (deprecated but supported)

HypnoticStandardNote
notSoDeep!=Use youCannotResist
deeplyGreater>=Use yourEyesAreGettingHeavy
deeplyLess<=Use goingDeeper

Logical Operators

HypnoticStandardMeaning
underMyControl&&Logical AND
resistanceIsFutile||Logical OR

Usage Notes

Case-Insensitivity

All keywords are case-insensitive during lexing but are normalized to their canonical form:

hyp
// All of the following are equivalent:
Focus { ... } Relax
focus { ... } relax
FOCUS { ... } RELAX

Standard Synonyms

For better readability, HypnoScript supports standard synonyms:

  • returnawaken
  • breaksnap
  • continuesink

Recommendations

  1. Use canonical forms for better readability
  2. Use hypnotic operators for thematic consistency
  3. Avoid legacy operators (notSoDeep, deeplyGreater, deeplyLess)
  4. Prefer induce over implant for standard variables
  5. Use freeze for immutable values instead of induce

Released under the MIT License.