summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'content/fate_v1/declarations')
-rw-r--r--content/fate_v1/declarations/_index.md6
-rw-r--r--content/fate_v1/declarations/events/_index.md18
-rw-r--r--content/fate_v1/declarations/files/_index.md48
-rw-r--r--content/fate_v1/declarations/sequences/_index.md113
-rw-r--r--content/fate_v1/declarations/text_effects/_index.md31
-rw-r--r--content/fate_v1/declarations/types/_index.md66
-rw-r--r--content/fate_v1/declarations/variables/_index.md72
7 files changed, 0 insertions, 354 deletions
diff --git a/content/fate_v1/declarations/_index.md b/content/fate_v1/declarations/_index.md
deleted file mode 100644
index 97a982e..0000000
--- a/content/fate_v1/declarations/_index.md
+++ /dev/null
@@ -1,6 +0,0 @@
----
-title: "Declarations"
-menuTitle: "Declarations"
-chapter: true
-weight: 2
----
diff --git a/content/fate_v1/declarations/events/_index.md b/content/fate_v1/declarations/events/_index.md
deleted file mode 100644
index 0c00d52..0000000
--- a/content/fate_v1/declarations/events/_index.md
+++ /dev/null
@@ -1,18 +0,0 @@
----
-title: Events
----
-Events are how a Fate narrative can communicate to the interpreter that
-something which cannot be expressed in Fate needs to be performed. The execution
-is paused until the event is resolved by the interpreter. To avoid mistakes, any
-event type must be declared before use.
-
-#### EVENT
-{{< fatecode >}}(declare_event_type {string} [C0 = TYPE] ... [CN = TYPE]){{< /fatecode >}}
-**Effect:** An event with the name `{string}` and taking parameters of types
-`[C0]`, ..., `[CN]` can be used.
-
-## Examples
-* `(declare_event_type user_string_input text (ptr string))`
-* `(declare_event_type wait int)`
-* `(declare_event_type set_background_to string)`
-* `(declare_event_type rumble)`
diff --git a/content/fate_v1/declarations/files/_index.md b/content/fate_v1/declarations/files/_index.md
deleted file mode 100644
index 05c6836..0000000
--- a/content/fate_v1/declarations/files/_index.md
+++ /dev/null
@@ -1,48 +0,0 @@
----
-title: File Management
----
-Fate narratives have one main file, but this file can use the contents of other
-files, and these files in turn can also use the contents of other files. Three
-issues arise then: some things must be declared before they are used, nothing
-should be declared multiple times, and where are the files?
-
-The absolute path to each file is computed in order to detect whether it has
-already been loaded. The given paths are expected to be relative. They are then
-resolved by attempting access from the following, in order: the current file's
-directory; the include directories passed as parameter to the executable; the
-calling executable's directory.
-
-Dependency cycles will raise compiling errors.
-
-The first "instruction" on each file must be `(fate_version 1)`. Values cannot
-be placed before either, obviously.
-
-{{< fatecode >}}(require {string}){{< /fatecode >}}
-
-**Effect:** If the file at `{string}` has not yet been loaded, load it.
-
-{{< fatecode >}}(include {string}){{< /fatecode >}}
-
-**Effect:** Load the `{string}`, even if it has already been loaded.
-
-#### Examples
-* `(require bonus_sequence.fate)`
-* `(include types/plant.fate)`
-* `(require ../guild/merchants.fate)`
-* `(include ../what/../are/../you/../doing/../there.fate)`
-* `(require oh/../oh/../oh/../this_is_fine.fate)`
-
-Example of Fate file:
-{{< fatecode >}};;; A story of great importance
-(fate_version 1)
-
-(require include/events.fate)
-(require include/text_effects.fate)
-
-(require scenes/the_holiday_forest.fate)
-
-`Twas a long time ago... Longer now that it seems... In a place that can't be
-referenced here because I'm pretty sure the transcript is copyrighted.
-
-(jump_to not_the_tree_door_i_would_have_chosen)
-{{< /fatecode >}}
diff --git a/content/fate_v1/declarations/sequences/_index.md b/content/fate_v1/declarations/sequences/_index.md
deleted file mode 100644
index a2fbcb1..0000000
--- a/content/fate_v1/declarations/sequences/_index.md
+++ /dev/null
@@ -1,113 +0,0 @@
----
-title: Sequences and Procedures
----
-Sequences and procedures are the same thing. These are named lists of
-instructions and values, which can be called upon at any point where
-instructions can be used. They can take parameters.
-
-Procedures do not return values. It is however possible to emulate something
-similar, by passing a pointer as a parameter and storing a "return" value into
-it.
-
-These are also intended to be used to describe scenes.
-
-The execution of a sequence can be terminated by using the `(done)`
-instruction. The execution of the narrative can be terminated by using the
-`(end)` instruction.
-
-Any value not part of an instruction will simply be displayed when it is
-reached during the procedure's execution.
-
-Sequences can be used before their definition, the compiler will raise an error
-if the use ends up being incorrect.
-
-Execution of a sequence can be started in two ways: `(call sequence_name)` will
-execute the sequence then continue with the execution of the current
-instruction list; `(jump_to sequence_name)` will replace the current
-instruction list by the execution of the sequence. If one were to ignore
-variables, the `(jump_to sequence_name)` instruction is similar to performing
-`(call sequence_name) (done)`.
-
-{{< fatecode >}}(define_sequence {String} (([C0 = TYPE] {V0 = String}) ... ([CN = TYPE] {VN = String})) [I0 = INSTRUCTIONS|VALUE] ... [IM = INSTRUCTIONS|VALUE]){{< /fatecode >}}
-**Effect:** Defines the sequence `{String}`, with variables `V0` ... `VN` of types `C0` ...`CN` as parameters, and instructions `I0` ... `IM` as content.
-
-**Acceptable Aliases:** `declare_sequence`, `def_seq`, `define_procedure`, `declare_procedure`, `def_proc`.
-
-#### Examples
-{{< fatecode >}}(define_sequence in_your_room ()
- (ifelse
- (is_member visited_your_room progress)
- (text_effect narrator
- You room is still a mess. You don't have time to clean things up,
- though.
- )
- (text_effect narrator
- You room is a mess. You recall having been through every drawer while
- preparing your bag yesterday. While still unclear on how you are
- supposed to pack all the necessary things for what promises to be at
- least a year-long journey inside a small backpack, you cannot avoid
- but wasting more time contemplating the piles of items that didn't
- make the cut.
- )
- )
- (add visited_your_room progress)
- (player_choice
- (
- ( Look for healing items )
- (jump_to look_for_healing_items)
- )
- (
- ( No time! Let's go adventuring! )
- (jump_to leave_your_room)
- )
- )
-)
-{{< /fatecode >}}
-
-{{< fatecode >}}(define_sequence index_of_loop
- (
- ((ptr int) result_holder)
- ((list int) collection)
- (int target)
- )
- (local int collection_size)
- (local int i)
-
- (set collection_size (size collection))
-
- (for (set i 0) (< (var i) (var collection_size)) (set i (+ (var i) 1))
- (if (= (access collection (var i)) (var target))
- (
- (set (at result_holder) (var i))
- (done)
- )
- )
- )
- (set (at result_holder) -1)
-)
-{{< /fatecode >}}
-
-
-{{< fatecode >}}(define_sequence index_of_jump
- (
- ((ptr int) result_holder)
- ((list int) collection)
- (int target)
- (int i)
- (int collection_size)
- )
- (ifelse (= (var i) (var collection_size))
- (set (at result_holder) -1)
- (ifelse (= (access collection (var i)) (var target))
- (set (at result_holder) (var i))
- (jump index_of_jump
- (var result_holder)
- (var collection)
- (var target)
- (+ (var i) 1)
- (var collection_size)
- )
- )
- )
-)
-{{< /fatecode >}}
diff --git a/content/fate_v1/declarations/text_effects/_index.md b/content/fate_v1/declarations/text_effects/_index.md
deleted file mode 100644
index fd3742d..0000000
--- a/content/fate_v1/declarations/text_effects/_index.md
+++ /dev/null
@@ -1,31 +0,0 @@
----
-title: Text Effects
----
-Text effects are attributes that can be given to text elements. The
-effects themselves can take parameters. To avoid errors that would be difficult
-to detect, Tonkadur expects text effects to be declared before being used.
-Note that multiple text effects can be applied to the same text elements,
-so there is no need to create text effects that combine other text effects.
-
-Two text effects cannot have the same name, even if their parameter types
-differ.
-
-Because text effects are handled by the interpreter, it is recommended to
-overlay their use by lambda functions. This way, each interpreter can simply
-expose its available text effects in a file, and the definition of the lambda
-functions can thus be changed according to which interpreter is used without
-having to go through the whole document. Furthermore, the name of text effects
-exposed by the interpreter might not match the name that would make the most
-sense to use within the narrative.
-
-### TEXT EFFECT
-{{< fatecode >}}(declare_text_effect {Identifier} [T0 = TYPE] ... [TN = TYPE]){{< /fatecode >}}
-Declares the text effect `{Identifier}`, with parameters of type `[T0]` ...
-`[TN]`.
-
-## Examples
-* `(declare_text_effect bold)`
-* `(declare_text_effect speaker string)`
-* `(declare_text_effect color int int int)`
-* `(declare_text_effect font string)`
-* `(declare_text_effect speaker_emotion string int)`
diff --git a/content/fate_v1/declarations/types/_index.md b/content/fate_v1/declarations/types/_index.md
deleted file mode 100644
index 5844895..0000000
--- a/content/fate_v1/declarations/types/_index.md
+++ /dev/null
@@ -1,66 +0,0 @@
----
-title: Types
----
-Fate is a strongly typed language.
-
-## Base Types
-There are a few base types already defined:
-
-* `int`: an integer, which is a number *without* fractional component (e.g. `-3`, `0`, `3`).
-* `float`: a number *with* a fractional component (e.g. `-3.14`, `0.0`, `3.9931`).
-* `bool`: a Boolean (i.e. `(true)` or `(false)`).
-* `string`: a list of characters, not including newlines (e.g. `bob`,
- `something else`, `日本のもの`, or `الاشياء العربية`). This cannot include
- computations: only hardcoded strings. `(lp)` will be substituted by a `(` and
- `(rp)` by a `)`, letting you use parentheses in a string.
-
-* `text`: a list of computations, interpreted as text, which may have
- attributes.
-
-Pointers are also available:
-* `(ptr [TYPE])`: a pointer to a memory element of type `[TYPE]` (e.g. `(ptr int)`, `(ptr (ptr string))`).
-If you are not familiar with pointers, a pointer is a value corresponding to an address containing a memory element.
-Accessing the value of the pointer yields the address, accessing the value pointed to by the value of the pointer yields the memory element.
-Pointers to pointers can be made, in which case that memory element is also an address to yet another memory element.
-Pointers still have to point to a definite type. Unlike in C, you cannot create a pointer to an unspecified type.
-
-Two collection types are available:
-* `(list [TYPE])`
-* `(set [COMPARABLE TYPE])`
-
-Lambda computations are available:
-* `(lambda [R = TYPE] ([A0 = TYPE] ... [AN = TYPE]))` is a type corresponding
- to a lambda function returning a value of type `R` and taking parameters of
- types `A0` ... `AN`.
-
-Procedures/sequences can be stored for future reference:
-* `(sequence ([A0 = TYPE] ... [AN = TYPE]))` is a type corresponding
- to a procedure/sequence taking parameters of types `A0` ... `AN`.
-
-### Common Type Groupings
-* `[NUMBER]` corresponds to `int`, `float`.
-* `[COLLECTION]` corresponds to `(list [TYPE])` and `(set [COMPARABLE TYPE])`.
-* `[PRIMITIVE]` `int`, `float`, `bool`, `string`, `text`.
-* `[COMPARABLE]` corresponds to `int`, `float`, `bool`, `string`, `text`,
- and `(ptr [TYPE])`. This indicates types for which operators such as `<` are
- defined.
-
-## Defining Your Own Types
-
-### Aliasing
-{{< fatecode >}}(declare_alias_type [TYPE] {String}){{< /fatecode >}}.
-**Effect:** Declares the type `{String}`. If `[TYPE]` is not a `[PRIMITIVE]`,
- `[TYPE]` and `{String}` are now two equivalent types. If `[TYPE]` is a
- `[PRIMITIVE]`, `{String}` is a subtype of `[TYPE]`.
-
-### Structures
-{{< fatecode >}}(declare_structure_type {String} ([T0 = TYPE] {F0 = String}) ... ([TN = TYPE] {fn = String})){{< /fatecode >}}.
-
-## Examples
-
-{{< fatecode >}}(define_structure_type player
- (creature creature)
- ((list (ptr item)) inventory)
- (int money)
-)
-{{< /fatecode >}}
diff --git a/content/fate_v1/declarations/variables/_index.md b/content/fate_v1/declarations/variables/_index.md
deleted file mode 100644
index 153135c..0000000
--- a/content/fate_v1/declarations/variables/_index.md
+++ /dev/null
@@ -1,72 +0,0 @@
----
-title: Variables
----
-Variables are what hold values. Each variable has a type, which cannot be
-changed.
-
-There are two variable scopes: local and global. A global variable can only be
-declared outside of any sequence. A local variable can also be declared within a
-sequence. Local variables can only be accessed within their context. In effect,
-a local variable declared outside of a sequence cannot be accessed in any
-sequence, and local variables cannot be accessed within lambda functions. Local
-variables can override global variables within their context.
-
-The sole exception to accessing a local variable outside its context is done
-through the use of pointers. Local variables live as long as the context
-that declared them does. Accessed one through a pointer past that point is
-likely to result in a runtime error and is, in any case, not to be done.
-
-Each sequence and lambda function defines its own context and thus does not
-share local variable with the others. Instructions which themselves contain
-instructions define hierarchies. Local variables defined within a hierarchical
-level can be accessed in that level and inner level, but are not shared with
-outer levels. For example:
-
-{{< fatecode >}}(if_else (var my_test)
- (
- (local int my_var) ;; my_var (a)
- (set my_var 32)
- )
- (
- ;; my_var (a) is not defined here.
- (local int my_var) ;; my_var (b)
- (set my_var 42)
- (if (var my_other_test)
- (
- (local int my_other_var)
- ;; Both my_other_var and my_var (b) are defined here
- )
- )
- ;; only my_var (b) is defined here
- )
-)
-{{< /fatecode >}}
-
-Generic instruction lists do not generate a new level of hierarchy:
-
-{{< fatecode >}}(
- (local int my_var)
-)
-;; my_var is still defined.
-{{< /fatecode >}}
-
-### LOCAL VARIABLE
-{{< fatecode >}}(local [TYPE] {Identifier}){{< /fatecode >}}
-Declares the local variable `{Identifier}` of type `[TYPE]`.
-
-### GLOBAL VARIABLE
-{{< fatecode >}}(global [TYPE] {Identifier}){{< /fatecode >}}
-Declares the global variable `{Identifier}` of type `[TYPE]`.
-
-## Example
-{{< fatecode >}}(local string name_of_dog)
-
-(global (ptr int) index_of_result)
-
-;; Here is an amusing use of variables:
-(global int something_unexpected)
-(local int something_unexpected)
-;; something_unexpected will not be the same variable within processes (which
-;; will use the global variable) and outside of them (which will use the local
-;; variable). For code readability reasons, I do not recommend doing this.
-{{< /fatecode >}}