From 0d2736d22ced1f9bf566192f8604f869e0f5c6b9 Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Wed, 5 May 2021 20:57:29 +0200 Subject: ... --- content/fate_v1/_index.md | 2 +- content/fate_v1/instructions/_index.md | 18 +++++++++--------- content/fate_v1/instructions/addresses/_index.md | 2 +- content/fate_v1/instructions/collections/_index.md | 10 +++++----- content/fate_v1/instructions/loops/_index.md | 2 +- content/fate_v1/instructions/player_choices/_index.md | 8 ++++---- content/fate_v1/types/_index.md | 7 +++---- content/fate_v1/variables/_index.md | 6 ++++++ 8 files changed, 30 insertions(+), 25 deletions(-) diff --git a/content/fate_v1/_index.md b/content/fate_v1/_index.md index 3f20dc4..2b14b63 100644 --- a/content/fate_v1/_index.md +++ b/content/fate_v1/_index.md @@ -21,7 +21,7 @@ Fate files are composed of three types of constructs: memory and return a value. * [Instructions](/fate_v1/instructions/), constructs that can modify the memory but do not return any values. -* [Declarations](/fate_v1/declarations/), special instructions that are +* Declarations, special instructions that are performed during compilation instead of during the execution. Other concepts in Fate include: diff --git a/content/fate_v1/instructions/_index.md b/content/fate_v1/instructions/_index.md index 21c2103..70e3987 100644 --- a/content/fate_v1/instructions/_index.md +++ b/content/fate_v1/instructions/_index.md @@ -7,30 +7,30 @@ interact with the interpreter. Computations are valid instructions, and will be automatically converted into `[TEXT]` to be displayed. ### ASSERT -{{< fatecode >}}(assert [BOOL] [TEXT]){{< /fatecode >}} +{{< fatecode >}}(assert! [BOOL] [TEXT]){{< /fatecode >}} Raises the exception `[TEXT]` to the interpreter if `[BOOL]` yields false. ### DONE -{{< fatecode >}}(done){{< /fatecode >}} +{{< fatecode >}}(done!){{< /fatecode >}} Completes the execution of the current sequence. ### END -{{< fatecode >}}(end){{< /fatecode >}} +{{< fatecode >}}(end!){{< /fatecode >}} Completes the execution of the script. ### SET VALUE -{{< fatecode >}}(set [REFERENCE] [COMPUTATION]){{< /fatecode >}} +{{< fatecode >}}(set! [REFERENCE] [COMPUTATION]){{< /fatecode >}} Gives the value `[COMPUTATION]` to `[REFERENCE]`. ### VISIT SEQUENCE -{{< fatecode >}}(visit {String} [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}} +{{< fatecode >}}(visit! {String} [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}} -{{< fatecode >}}(visit [SEQUENCE] [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}} +{{< fatecode >}}(visit! [SEQUENCE] [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}} Visits the sequence named `{String}` (or stored in `[SEQUENCE]`), with `C0` ... `CN` as arguments. That sequence does not need to already have been defined. @@ -38,9 +38,9 @@ Visiting a sequence means that the execution of the current sequence continues once the visited sequence has completed. ### JUMP TO SEQUENCE -{{< fatecode >}}(jump_to {String} [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}} +{{< fatecode >}}(jump_to! {String} [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}} -{{< fatecode >}}(jump_to [SEQUENCE] [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}} +{{< fatecode >}}(jump_to! [SEQUENCE] [C0 = COMPUTATION] ... [CN = COMPUTATION]){{< /fatecode >}} Jumps to the sequence named `{String}` (or stored in `[SEQUENCE]`), with `C0` ... `CN` as arguments. That sequence does not need to already have been @@ -48,6 +48,6 @@ defined. Jumping to a sequence means that the execution of the current sequence is replaced by that of the target sequence. ### INSTRUCTION LIST -{{< fatecode >}}([C0 = INSTRUCTION] ... [CN = INSTRUCTION]){{< /fatecode >}} +{{< fatecode >}}( [C0 = INSTRUCTION] ... [CN = INSTRUCTION]){{< /fatecode >}} Instruction corresponding to the execution of `[C0]` ... `[CN]` in order. diff --git a/content/fate_v1/instructions/addresses/_index.md b/content/fate_v1/instructions/addresses/_index.md index e296f2c..1b9cdc1 100644 --- a/content/fate_v1/instructions/addresses/_index.md +++ b/content/fate_v1/instructions/addresses/_index.md @@ -2,6 +2,6 @@ title: Addresses --- ### DE-ALLOCATION -{{< fatecode >}}(free [POINTER]){{< /fatecode >}} +{{< fatecode >}}(free! [POINTER]){{< /fatecode >}} Removes the memory element at `[POINTER]` from the memory. diff --git a/content/fate_v1/instructions/collections/_index.md b/content/fate_v1/instructions/collections/_index.md index 5ecd3a0..fb557c2 100644 --- a/content/fate_v1/instructions/collections/_index.md +++ b/content/fate_v1/instructions/collections/_index.md @@ -29,27 +29,27 @@ Adds all the elements of `[COLLECTION]` to `[COLLECTION VAR]`. If list. ### EMPTYING COLLECTIONS -{{< fatecode >}}(clear [COLLECTION]){{< /fatecode >}} +{{< fatecode >}}(clear! [COLLECTION]){{< /fatecode >}} Removes all members of `[COLLECTION]`. ### REMOVING MEMBER -{{< fatecode >}}(remove [COMPUTATION] [COLLECTION]){{< /fatecode >}} +{{< fatecode >}}(remove! [COMPUTATION] [COLLECTION]){{< /fatecode >}} Removes the first member of `[COLLECTION]` equal to `[COMPUTATION]`. ### REMOVING MEMBERS -{{< fatecode >}}(remove_all [COMPUTATION] [COLLECTION]){{< /fatecode >}} +{{< fatecode >}}(remove_all! [COMPUTATION] [COLLECTION]){{< /fatecode >}} Removes all instances of `[COMPUTATION]` from `[COLLECTION]`. ### REMOVING AT INDEX -{{< fatecode >}}(remove_at [INT] [COLLECTION]){{< /fatecode >}} +{{< fatecode >}}(remove_at! [INT] [COLLECTION]){{< /fatecode >}} Removes the element of `[COLLECTION]` at `[INT]`. ### REVERSING LISTS -{{< fatecode >}}(reverse [LIST]){{< /fatecode >}} +{{< fatecode >}}(reverse! [LIST]){{< /fatecode >}} Reverses the order of the members of `[LIST]`. diff --git a/content/fate_v1/instructions/loops/_index.md b/content/fate_v1/instructions/loops/_index.md index d3c8d65..5aa14ac 100644 --- a/content/fate_v1/instructions/loops/_index.md +++ b/content/fate_v1/instructions/loops/_index.md @@ -29,6 +29,6 @@ Executes `[I0]` ... `[IM]` for each member of `[COLLECTION]`, in order. The curr member is stored in a new local variable named `{String}`. ### BREAK -{{< fatecode >}}(break){{< /fatecode >}} +{{< fatecode >}}(break!){{< /fatecode >}} Exits the current loop. diff --git a/content/fate_v1/instructions/player_choices/_index.md b/content/fate_v1/instructions/player_choices/_index.md index 4aea5a0..9ead97c 100644 --- a/content/fate_v1/instructions/player_choices/_index.md +++ b/content/fate_v1/instructions/player_choices/_index.md @@ -6,26 +6,26 @@ with a list of `[TEXT]` choices, and executing a list of instructions associated to the choice they have made. ### CHOICE OPTION -{{< fatecode >}}([TEXT] [I0 = INSTRUCTION] ... [IN = INSTRUCTION]){{< /fatecode >}} +{{< fatecode >}}(option [TEXT] [I0 = INSTRUCTION] ... [IN = INSTRUCTION]){{< /fatecode >}} Adds a choice showing `[TEXT]` to the user, and executing `[I0]` ... `[IN]` if chosen. ### CHOICE PROMPT -{{< fatecode >}}(player_choice [C0 = CHOICE] ... [C1 = CHOICE]){{< /fatecode >}} +{{< fatecode >}}(player_choice! [C0 = CHOICE] ... [C1 = CHOICE]){{< /fatecode >}} Prompts the user to choose between `C0` ... `C1`. `[CHOICE]`. `[CHOICE]` is either an option as shown above, a [conditional](../conditionals), or a `for_each` (see [loops](../loops)) with `[CHOICE]` instead of `[INSTRUCTION]`. ### INTEGER PROMPT -{{< fatecode >}}(prompt_integer [INT REFERENCE] [MIN = INT] [MAX = INT] [TEXT]){{< /fatecode >}} +{{< fatecode >}}(prompt_integer! [INT REFERENCE] [MIN = INT] [MAX = INT] [TEXT]){{< /fatecode >}} Prompts the user for an integer between `[MIN]` and `[MAX]` by displaying the message `[TEXT]`. The result is stored in `[INT REFERENCE]`. ### STRING PROMPT -{{< fatecode >}}(prompt_string [STRING REFERENCE] [MIN = INT] [MAX = INT] [TEXT]){{< /fatecode >}} +{{< fatecode >}}(prompt_string! [STRING REFERENCE] [MIN = INT] [MAX = INT] [TEXT]){{< /fatecode >}} Prompts the user for a string of size between `[MIN]` and `[MAX]` by displaying the message `[TEXT]`. The result is stored in `[STRING REFERENCE]`. diff --git a/content/fate_v1/types/_index.md b/content/fate_v1/types/_index.md index b778383..b6e5c4d 100644 --- a/content/fate_v1/types/_index.md +++ b/content/fate_v1/types/_index.md @@ -93,7 +93,7 @@ Examples of list types: Examples of lists: * {{< fatecode >}}(range 0 10 1){{< /fatecode >}} -* {{< fatecode >}}(add 0 1 2 3 4 (default (list int))){< /fatecode >}} +* {{< fatecode >}}(add 0 1 2 3 4 (default (list int))){{< /fatecode >}} * {{< fatecode >}}(add_all (range 0 10 1) (range -10 -1 1)){{< /fatecode >}} Sets are collections of elements with a comparable type. The comparables types, @@ -110,7 +110,7 @@ Examples of set types: * {{< fatecode >}}(set string){{< /fatecode >}} Examples of sets: -* {{< fatecode >}}(add 6 1 4 2 900 (default (set int))){< /fatecode >}} +* {{< fatecode >}}(add 6 1 4 2 900 (default (set int))){{< /fatecode >}} * {{< fatecode >}}(add_all (range 0 10 1) (set int)){{< /fatecode >}} ### Lambda Expressions @@ -189,5 +189,4 @@ Examples of computations returning a sequence or procedure value: (creature creature) ((list (ptr item)) inventory) (int money) -) -{{< /fatecode >}} +){{< /fatecode >}} diff --git a/content/fate_v1/variables/_index.md b/content/fate_v1/variables/_index.md index a182dd0..a428b2c 100644 --- a/content/fate_v1/variables/_index.md +++ b/content/fate_v1/variables/_index.md @@ -59,6 +59,12 @@ Declares the local variable `{Identifier}` of type `[TYPE]`. {{< fatecode >}}(global [TYPE] {Identifier}){{< /fatecode >}} Declares the global variable `{Identifier}` of type `[TYPE]`. +### EXTERNAL VARIABLE +{{< fatecode >}}(external [TYPE] {Identifier}){{< /fatecode >}} +Declares the external variable `{Identifier}` of type `[TYPE]`. +External variables do not get initialized and are assumed to already have been +set prior to the narrative starting. + ## Example {{< fatecode >}}(local string name_of_dog) -- cgit v1.2.3-70-g09d2