-
Notifications
You must be signed in to change notification settings - Fork 0
Expand HypnoScript language definition with comprehensive standard library and enhanced hypnotic features #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
6a7bb79
Initial plan
Copilot a0b6654
Add comprehensive standard library and enhanced hypnotic features
Copilot 5641767
Update EBNF grammar to include new language features
Copilot a608149
Add interactive hypno-pendulum simulator example
Copilot 5b31705
Update DEFINITION.md
JosunLP 1a153de
Fix code review issues
Copilot 31cb615
Update DEFINITION.md
JosunLP dfd9eaf
Improve Language definition
JosunLP 90944c1
Update DEFINITION.md
JosunLP 1fbf186
Update DEFINITION.md
JosunLP ba39d94
Fix undefined function call in example
Copilot c4f5f6e
Füge Beispiele für Trigger und Event-Hooks in die Dokumentation ein
JosunLP 9751a1f
Merge branch 'copilot/improve-hyposcript-definition' of https://githu…
JosunLP f56fea8
Füge Beispiele für Trigger und Event-Handler zur Dokumentation hinzu
JosunLP 7aa580a
Update examples/21_hypno_pendulum_simulator.hyp
JosunLP 3465ef4
Update DEFINITION.md
JosunLP 017b4fa
Update examples/16_standard_library_strings.hyp
JosunLP cdceb61
Update examples/17_standard_library_datastructures.hyp
JosunLP 8b133c5
Update DEFINITION.md
JosunLP 8ef07af
Update DEFINITION.md und Beispiele für Trigger und Callbacks in Hypno…
JosunLP 2c9c226
Update DEFINITION.md: Präzisierung der Beschreibung für `anchor` in H…
JosunLP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| Focus { | ||
|
|
||
| entrance { | ||
| observe "=== Hypno-Math Bibliothek Demo ==="; | ||
| } | ||
|
|
||
| // Grundlegende mathematische Operationen | ||
| induce radius: number = 5.0; | ||
| induce area: number = hypnoticPi() * power(radius, 2); | ||
| observe "Kreisfläche mit Radius " + radius + ": " + area; | ||
|
|
||
| // Trigonometrische Funktionen (Pendel-Bewegungen) | ||
| induce angle: number = 45.0; | ||
| induce sine: number = pendulumSin(angle); | ||
| induce cosine: number = pendulumCos(angle); | ||
| observe "Sinus von " + angle + " Grad: " + sine; | ||
| observe "Cosinus von " + angle + " Grad: " + cosine; | ||
|
|
||
| // Rundungsfunktionen | ||
| induce floatNum: number = 3.7; | ||
| observe "floor(" + floatNum + ") = " + floor(floatNum); | ||
| observe "ceiling(" + floatNum + ") = " + ceiling(floatNum); | ||
| observe "roundToNearest(" + floatNum + ") = " + roundToNearest(floatNum); | ||
|
|
||
| // Min/Max (Dominant/Submissive) | ||
| induce a: number = 42; | ||
| induce b: number = 17; | ||
| observe "Dominant (max) von " + a + " und " + b + ": " + selectDominant(a, b); | ||
| observe "Submissive (min) von " + a + " und " + b + ": " + selectSubmissive(a, b); | ||
|
|
||
| // Zufallszahlen (Unbewusste Entscheidungen) | ||
| observe "Unbewusste Zufallszahl zwischen 1 und 100: " + unconsciousInt(1, 100); | ||
| observe "Unbewusste boolean Entscheidung: " + unconsciousBool(); | ||
|
|
||
| // Potenz und Wurzel | ||
| induce base: number = 2; | ||
| induce exponent: number = 10; | ||
| observe base + " hoch " + exponent + " = " + power(base, exponent); | ||
| observe "Quadratwurzel von 16: " + squareRoot(16); | ||
|
|
||
| finale { | ||
| observe "=== Demo beendet ==="; | ||
| } | ||
|
|
||
| } Relax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| Focus { | ||
|
|
||
| entrance { | ||
| observe "=== StringSpell Bibliothek Demo ==="; | ||
| } | ||
|
|
||
| // String-Manipulation | ||
| induce message: string = " Willkommen in der Trance "; | ||
| induce cleaned: string = trimEdges(message); | ||
| observe "Original: '" + message + "'"; | ||
| observe "Bereinigt: '" + cleaned + "'"; | ||
|
|
||
| // Länge messen | ||
| observe "Tiefe der Nachricht: " + measureDepth(cleaned); | ||
|
|
||
| // String zerlegen und zusammenfügen | ||
| induce words: string[] = fragmentMemory(cleaned, " "); | ||
| observe "Wörter: " + mergeThoughts(words, ", "); | ||
| observe "Anzahl Wörter: " + vaultSize(words); | ||
|
|
||
| induce rejoined: string = mergeThoughts(words, "-"); | ||
| observe "Zusammengefügt mit '-': " + rejoined; | ||
|
|
||
| // String-Transformation | ||
| induce loud: string = toUpper(cleaned); | ||
| induce quiet: string = toLower(cleaned); | ||
| observe "LAUT (Befehl): " + loud; | ||
| observe "leise (flüstern): " + quiet; | ||
|
|
||
| // String umkehren | ||
| induce reversed: string = reverseTrance("Hypnose"); | ||
| observe "Umgekehrt: " + reversed; | ||
|
|
||
| // Mantra wiederholen | ||
| induce mantra: string = repeatMantra("Om ", 5); | ||
| observe "Mantra: " + mantra; | ||
|
|
||
| // Muster suchen und ersetzen | ||
| induce text: string = "Du bist in Trance, tiefer Trance"; | ||
| if (containsPattern(text, "Trance")) { | ||
| observe "Das Wort 'Trance' wurde gefunden!"; | ||
| } | ||
|
|
||
| induce replaced: string = replaceAllMemories(text, "Trance", "Entspannung"); | ||
| observe "Ersetzt: " + replaced; | ||
|
|
||
| // String-Prüfungen | ||
| if (startsWithSuggestion(text, "Du bist")) { | ||
| observe "Der Text beginnt mit 'Du bist'"; | ||
| } | ||
|
|
||
| if (endsWithAwakening(text, "Trance")) { | ||
| observe "Der Text endet mit 'Trance'"; | ||
| } | ||
|
|
||
| finale { | ||
| observe "=== StringSpell Demo beendet ==="; | ||
| } | ||
|
|
||
| } Relax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| Focus { | ||
|
|
||
| entrance { | ||
| observe "=== MemoryPalace Datenstrukturen Demo ==="; | ||
| } | ||
|
|
||
| // Array-Operationen | ||
| induce memories: number[] = [10, 5, 8, 3, 12, 7]; | ||
| observe "Original Memories: " + memories; | ||
| observe "Vault-Größe: " + vaultSize(memories); | ||
|
|
||
| // Sortieren | ||
| induce sorted: number[] = sortMemories(memories); | ||
| observe "Sortiert: " + sorted; | ||
|
|
||
| // Umkehren | ||
| induce reversed: number[] = reverseMemories(memories); | ||
| observe "Umgekehrt: " + reversed; | ||
|
|
||
| // Erstes und letztes Element | ||
| observe "Erste Erinnerung: " + firstMemory(memories); | ||
| observe "Letzte Erinnerung: " + lastMemory(memories); | ||
|
|
||
| // Map - Alle Werte verdoppeln | ||
| induce doubled: number[] = mapMemories(memories, suggestion(x: number): number { | ||
| awaken x * 2; | ||
| }); | ||
| observe "Verdoppelt: " + doubled; | ||
|
|
||
| // Filter - Nur Werte > 6 | ||
| induce filtered = filterMemories(memories, suggestion(x: number): boolean { | ||
| awaken x lookAtTheWatch 6; | ||
| }); | ||
| observe "Gefiltert (> 6): " + filtered; | ||
|
|
||
| // Reduce - Summe berechnen | ||
| induce sum = reduceToEssence(memories, suggestion(acc: number, x: number): number { | ||
| awaken acc + x; | ||
| }, 0); | ||
| observe "Summe aller Erinnerungen: " + sum; | ||
|
|
||
| // Stack (LIFO) - Last In, First Out | ||
| observe ""; | ||
| observe "--- MindStack Demo ---"; | ||
| induce stack = MindStack(); | ||
| stack.push("Erste Ebene"); | ||
| stack.push("Zweite Ebene"); | ||
| stack.push("Dritte Ebene (Oberste)"); | ||
|
|
||
| observe "Stack-Größe: " + stack.size(); | ||
| observe "Peek (ohne zu entfernen): " + stack.peek(); | ||
| observe "Pop: " + stack.pop(); | ||
| observe "Pop: " + stack.pop(); | ||
| observe "Verbleibende Größe: " + stack.size(); | ||
|
|
||
| // Queue (FIFO) - First In, First Out | ||
| observe ""; | ||
| observe "--- ThoughtQueue Demo ---"; | ||
| induce queue = ThoughtQueue(); | ||
| queue.enqueue("Gedanke 1"); | ||
| queue.enqueue("Gedanke 2"); | ||
| queue.enqueue("Gedanke 3"); | ||
|
|
||
| observe "Queue-Größe: " + queue.size(); | ||
| observe "Dequeue: " + queue.dequeue(); | ||
| observe "Dequeue: " + queue.dequeue(); | ||
| observe "Verbleibende Größe: " + queue.size(); | ||
|
|
||
| // MemoryMap (Dictionary/Hash) | ||
| observe ""; | ||
| observe "--- MemoryMap Demo ---"; | ||
| induce map = MemoryMap(); | ||
| map.store("name", "Alice"); | ||
| map.store("alter", 30); | ||
| map.store("beruf", "Hypnotiseurin"); | ||
|
|
||
| observe "Name: " + map.retrieve("name"); | ||
| observe "Alter: " + map.retrieve("alter"); | ||
| observe "Beruf: " + map.retrieve("beruf"); | ||
|
|
||
| observe "Alle Schlüssel: " + map.allKeys(); | ||
| observe "Hat 'name' Schlüssel? " + map.hasKey("name"); | ||
|
|
||
| map.forget("alter"); | ||
| observe "Nach Löschen von 'alter': " + map.allKeys(); | ||
|
|
||
| finale { | ||
| observe "=== MemoryPalace Demo beendet ==="; | ||
| } | ||
|
|
||
| } Relax |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| Focus { | ||
|
|
||
| entrance { | ||
| observe "=== Erweiterte Hypnotische Features Demo ==="; | ||
| } | ||
|
|
||
| // Verwende alle hypnotischen Operator-Synonyme | ||
| induce x: number = 10; | ||
| induce y: number = 10; | ||
| induce z: number = 5; | ||
|
|
||
| observe "=== Hypnotische Operator-Synonyme ==="; | ||
|
|
||
| // youAreFeelingVerySleepy (==) | ||
| if (x youAreFeelingVerySleepy y) { | ||
| observe "x youAreFeelingVerySleepy y: x ist gleich y!"; | ||
| } | ||
|
|
||
| // youCannotResist (!=) | ||
| if (x youCannotResist z) { | ||
| observe "x youCannotResist z: x ist ungleich z!"; | ||
| } | ||
|
|
||
| // lookAtTheWatch (>) | ||
| if (x lookAtTheWatch z) { | ||
| observe "x lookAtTheWatch z: x ist größer als z!"; | ||
| } | ||
|
|
||
| // fallUnderMySpell (<) | ||
| if (z fallUnderMySpell x) { | ||
| observe "z fallUnderMySpell x: z ist kleiner als x!"; | ||
| } | ||
|
|
||
| // yourEyesAreGettingHeavy (>=) | ||
| if (x yourEyesAreGettingHeavy y) { | ||
| observe "x yourEyesAreGettingHeavy y: x ist größer oder gleich y!"; | ||
| } | ||
|
|
||
| // goingDeeper (<=) | ||
| if (z goingDeeper x) { | ||
| observe "z goingDeeper x: z ist kleiner oder gleich x!"; | ||
| } | ||
|
|
||
| // underMyControl (&&) | ||
| if (x lookAtTheWatch 5 underMyControl y lookAtTheWatch 5) { | ||
| observe "Beide Bedingungen erfüllt mit underMyControl (&&)!"; | ||
| } | ||
|
|
||
| // resistanceIsFutile (||) | ||
| if (x lookAtTheWatch 100 resistanceIsFutile y youAreFeelingVerySleepy 10) { | ||
| observe "Mindestens eine Bedingung erfüllt mit resistanceIsFutile (||)!"; | ||
| } | ||
|
|
||
| observe ""; | ||
| observe "=== Neue Sprachfeatures ==="; | ||
|
|
||
| // Freeze - Unveränderliche Variable | ||
| freeze PI: number = 3.14159; | ||
| observe "PI (eingefroren): " + PI; | ||
| // PI = 3.0; // Würde einen Fehler verursachen! | ||
|
|
||
| // Whisper - Ausgabe ohne Zeilenumbruch | ||
| whisper "Dies ist eine "; | ||
| whisper "zusammenhängende "; | ||
| whisper "Nachricht"; | ||
| observe ""; // Zeilenumbruch | ||
|
|
||
| // Oscillate - Toggle-Funktion | ||
| induce isActive: boolean = false; | ||
| observe "isActive vor oscillate: " + isActive; | ||
| oscillate isActive; | ||
| observe "isActive nach 1x oscillate: " + isActive; | ||
| oscillate isActive; | ||
| observe "isActive nach 2x oscillate: " + isActive; | ||
|
|
||
| // Anchor - Zustand speichern und wiederherstellen | ||
| induce counter: number = 42; | ||
| anchor savedCounter = counter; | ||
| observe "Original counter: " + counter; | ||
|
|
||
| counter = 100; | ||
| observe "Geänderter counter: " + counter; | ||
|
|
||
| counter = savedCounter; | ||
| observe "Wiederhergestellter counter: " + counter; | ||
|
|
||
| // DeepFocus-Blöcke und deeperStill | ||
| observe ""; | ||
| observe "=== DeepFocus Blöcke ==="; | ||
|
|
||
| if (x lookAtTheWatch 5) deepFocus { | ||
| observe "In tiefem Fokus..."; | ||
|
|
||
| if (y lookAtTheWatch 8) deeperStill { | ||
| observe "Noch tiefer im Fokus!"; | ||
| } | ||
| } | ||
|
|
||
| // Implant - Alternative Variablendeklaration | ||
| implant secretValue: number = 999; | ||
| observe "Implantierter Wert: " + secretValue; | ||
|
|
||
| // Command - Imperative Ausgabe | ||
| command "AUFWACHEN!"; | ||
|
|
||
| finale { | ||
| observe ""; | ||
| observe "=== Demo abgeschlossen ==="; | ||
| observe "Du erwachst aus der Trance..."; | ||
| } | ||
|
|
||
| } Relax |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.