viv-compiler 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -20,6 +20,7 @@ if TYPE_CHECKING:
20
20
  FloatField,
21
21
  IntField,
22
22
  ListField,
23
+ LocalVariable,
23
24
  ObjectField,
24
25
  StringField,
25
26
  TemplateStringField,
@@ -46,9 +47,9 @@ class CompiledContentBundleMetadata(TypedDict):
46
47
  The metadata here is also used to support validation during initialization of a target application's
47
48
  Viv adapter by, e.g., confirming that any referenced enums and adapter functions actually exist.
48
49
  """
49
- # The Viv compiler version at the time of compiling this content bundle. If this
50
- # version number corresponds to the version number for a Viv runtime, the content
51
- # bundle is guaranteed to be compatible with that runtime.
50
+ # The Viv compiler version at the time of compiling this content bundle. This will be a
51
+ # `MAJOR.MINOR.PATCH` version, and all Viv runtimes will require that the `MAJOR.MINOR`
52
+ # portion matches that of the runtime version at hand.
52
53
  vivVersion: str
53
54
  # An array containing the names of all enums referenced in the content bundle. This is
54
55
  # used for validation during the initialization of a target application's Viv adapter.
@@ -94,7 +95,7 @@ class TropeDefinition(TypedDict):
94
95
  name: TropeName
95
96
  # The parameters for the trope. These take entity references as arguments,
96
97
  # allowing the conditions to refer to those entities.
97
- params: list[TropeParamName]
98
+ params: list[TropeParam]
98
99
  # The ordered set of conditions composing the trope
99
100
  conditions: list[Expression]
100
101
 
@@ -102,6 +103,16 @@ class TropeDefinition(TypedDict):
102
103
  # A unique name for a trope
103
104
  TropeName = str
104
105
 
106
+
107
+ class TropeParam(TypedDict):
108
+ """A trope parameter."""
109
+ # The name of the trope parameter (unique only within the trope definition)
110
+ name: TropeParamName
111
+ # Whether this is an entity trope parameter, in which case arguments
112
+ # for this parameter should be entity IDs.
113
+ isEntityParam: bool
114
+
115
+
105
116
  # A unique trope parameter name
106
117
  TropeParamName = str
107
118
 
@@ -129,8 +140,8 @@ class ActionDefinition(TypedDict):
129
140
  preconditions: dict[RoleName, list[WrappedExpression]]
130
141
  # An ordered set of expressions that prepare a set of temporary variables that may be referenced
131
142
  # downstream in the action definition. These temporary variables can be referenced by an author
132
- # using the `$` sigil, but this is syntactic sugar for `@this.scratch` — e.g., `$foo` is equivalent
133
- # to `@this.scratch.foo`.
143
+ # using the `$` sigil, but this is syntactic sugar for `@this.scratch` — e.g., `$&foo` is equivalent
144
+ # to `@this.scratch.foo`, with the second sigil indicating the type of the scratch variable.
134
145
  scratch: list[Expression]
135
146
  # An ordered set of expressions that, when executed, cause updates to the target application state
136
147
  effects: list[WrappedExpression]
@@ -250,25 +261,19 @@ class ReactionValue(TypedDict):
250
261
  # The name of the target action, i.e., the one queued up by this reaction
251
262
  actionName: ActionName
252
263
  # Specification for how to precast entities in (a subset of) the roles of the target action
253
- bindings: list[ReactionBinding]
264
+ bindings: list[ReactionRoleBindings]
254
265
  # Parameterization of the reaction along various options
255
266
  options: ReactionOptions
256
267
 
257
268
 
258
- class ReactionBinding(TypedDict):
269
+ class ReactionRoleBindings(TypedDict):
259
270
  """An expression specifying how to precast a particular role in a reaction's target action."""
260
- # Discriminator for Viv binding expressions
261
- type: Literal[ExpressionDiscriminator.BINDING]
262
- # The actual expression value
263
- value: ReactionBindingValue
264
-
265
-
266
- class ReactionBindingValue(TypedDict):
267
- """Value of a binding expression."""
268
- # The name of the role in the target action that will be precast via this binding
271
+ # The name of the role in the target action that will be precast via these bindings
269
272
  role: RoleName
270
- # An expression that should evaluate to the entity to precast in the role associated with this binding
271
- entity: Expression
273
+ # Whether the bindings are marked as being associated with an entity role
274
+ isEntityRole: bool
275
+ # An expression that should evaluate to the candidate(s) to precast in the role associated with this binding
276
+ candidates: Expression
272
277
 
273
278
 
274
279
  class ReactionOptions(TypedDict, total=False):
@@ -313,10 +318,10 @@ class Saliences(TypedDict):
313
318
  # which no `body` expressions hold. This will always be structured as a Viv enum,
314
319
  # int, or float, where even the enum should resolve to a numeric value.
315
320
  default: Union[Enum, IntField, FloatField]
316
- # The name of the variable to which a character will be bound when computing a salience for
317
- # them. This allows for evaluation of the body expressions, which may refer to this variable
318
- # in order to do things like conditionalize salience based on the character at hand.
319
- variable: VariableName
321
+ # If there is a non-empty body, the local variable to which a character will be bound when computing
322
+ # a salience for them. This allows for evaluation of the body expressions, which may refer to this
323
+ # variable in order to do things like conditionalize salience based on the character at hand.
324
+ variable: LocalVariable | None
320
325
  # An ordered array of Viv expressions that will each evaluate to a numeric value, as in the
321
326
  # `default` property. These will be evaluated in turn, with the first numeric evaluated value
322
327
  # being assigned as the character's salience. If no body expression evaluates to a numeric
@@ -332,10 +337,10 @@ class Associations(TypedDict):
332
337
  # `body` expressions hold. This will always be structured as a Viv list whose elements will be
333
338
  # simple Viv string expressions.
334
339
  default: ListField
335
- # The name of the variable to which a character will be bound when computing associations for
336
- # them. This allows for evaluation of the body expressions, which may refer to this variable
337
- # in order to do things like conditionalize associations based on the character at hand.
338
- variable: VariableName
340
+ # If there is a non-empty body, the local variable to which a character will be bound when computing
341
+ # associations for them. This allows for evaluation of the body expressions, which may refer to this
342
+ # variable in order to do things like conditionalize associations based on the character at hand.
343
+ variable: LocalVariable | None
339
344
  # An ordered array of Viv expressions that will each evaluate to Viv lists containing simple
340
345
  # Viv string expressions, as in the `default` property. These will be evaluated in turn, with
341
346
  # all the results being concatenated together to compose the associations for the character
@@ -36,7 +36,6 @@ Expression: TypeAlias = Annotated[
36
36
  "FloatField",
37
37
  "IntField",
38
38
  "ListField",
39
- "LocalVariableReference",
40
39
  "Loop",
41
40
  "MembershipTest",
42
41
  "NullField",
@@ -44,6 +43,7 @@ Expression: TypeAlias = Annotated[
44
43
  "Reaction",
45
44
  "RoleUnpacking",
46
45
  "StringField",
46
+ "SymbolReference",
47
47
  "TemplateStringField",
48
48
  "TropeFitExpression",
49
49
  ],
@@ -56,7 +56,6 @@ class ExpressionDiscriminator(StrEnum):
56
56
  ADAPTER_FUNCTION_CALL = "adapterFunctionCall"
57
57
  ASSIGNMENT = "assignment"
58
58
  ARITHMETIC_EXPRESSION = "arithmeticExpression"
59
- BINDING = "binding"
60
59
  BOOL = "bool"
61
60
  CHANCE_EXPRESSION = "chanceExpression"
62
61
  COMPARISON = "comparison"
@@ -69,7 +68,6 @@ class ExpressionDiscriminator(StrEnum):
69
68
  FLOAT = "float"
70
69
  INT = "int"
71
70
  LIST = "list"
72
- LOCAL_VARIABLE_REFERENCE = "localVariableReference"
73
71
  LOOP = "loop"
74
72
  MEMBERSHIP_TEST = "membershipTest"
75
73
  NULL_TYPE = "nullType"
@@ -77,6 +75,7 @@ class ExpressionDiscriminator(StrEnum):
77
75
  REACTION = "reaction"
78
76
  ROLE_UNPACKING = "roleUnpacking"
79
77
  STRING = "string"
78
+ SYMBOL_REFERENCE = "symbolReference"
80
79
  TEMPLATE_STRING = "templateString"
81
80
  TROPE_FIT_EXPRESSION = "tropeFitExpression"
82
81
 
@@ -97,7 +96,7 @@ class AdapterFunctionCall(NegatableExpression):
97
96
  `transport()` exposed in the adapter. The Viv runtime confirms the existence of all
98
97
  referenced function names during adapter initialization.
99
98
  """
100
- # Discriminant for a Viv adapter function call
99
+ # Discriminator for a Viv adapter function call
101
100
  type: Literal[ExpressionDiscriminator.ADAPTER_FUNCTION_CALL]
102
101
  # The actual expression value
103
102
  value: AdapterFunctionCallValue
@@ -122,7 +121,7 @@ AdapterFunctionName = str
122
121
 
123
122
  class ArithmeticExpression(TypedDict):
124
123
  """A Viv arithmetic expression, which accepts two numeric operands and evaluates to a number."""
125
- # Discriminant for a Viv arithmetic expression
124
+ # Discriminator for a Viv arithmetic expression
126
125
  type: Literal[ExpressionDiscriminator.ARITHMETIC_EXPRESSION]
127
126
  # The actual expression value
128
127
  value: ArithmeticExpressionValue
@@ -144,7 +143,7 @@ ArithmeticOperator = Literal["+", "-", "*", "/"]
144
143
 
145
144
  class Assignment(TypedDict):
146
145
  """A Viv assignment (or update)."""
147
- # Discriminant for a Viv assignment
146
+ # Discriminator for a Viv assignment
148
147
  type: Literal[ExpressionDiscriminator.ASSIGNMENT]
149
148
  # The actual expression value
150
149
  value: AssignmentValue
@@ -153,10 +152,13 @@ class Assignment(TypedDict):
153
152
  class AssignmentValue(TypedDict):
154
153
  """The actual expression value for a Viv assignment."""
155
154
  # An expression whose evaluation will be used as the left operand in the assignment/update
156
- left: Expression
155
+ left: Union[EntityReference, SymbolReference]
157
156
  # The assignment/update operator
158
157
  operator: AssignmentOperator
159
- # An expression whose evaluation will be used as the right operand in the assignment/update
158
+ # An expression whose evaluation will be used as the right operand in the assignment/update. Note
159
+ # that for assignments that update persistent entity data, the value will always be proactively
160
+ # dehydrated, such that all entity data included in the value will be converted into the associated
161
+ # entity ID. We do this to prevent several potential issues, and the data can be rehydrated later on.
160
162
  right: Expression
161
163
 
162
164
 
@@ -166,7 +168,7 @@ AssignmentOperator = Literal["=", "+=", "-=", "*=", "/=", "append", "remove"]
166
168
 
167
169
  class BoolField(TypedDict):
168
170
  """A Viv boolean."""
169
- # Discriminant for a Viv boolean
171
+ # Discriminator for a Viv boolean
170
172
  type: Literal[ExpressionDiscriminator.BOOL]
171
173
  # The boolean literal to which this expression will evaluate
172
174
  value: bool
@@ -178,7 +180,7 @@ class ChanceExpression(TypedDict):
178
180
  This is a kind of condition that evaluates to True if the specified probability value (a number
179
181
  between 0.0 and 1.0) exceeds a pseudorandom number generated by the Viv interpreter.
180
182
  """
181
- # Discriminant for a Viv chance expression
183
+ # Discriminator for a Viv chance expression
182
184
  type: Literal[ExpressionDiscriminator.CHANCE_EXPRESSION]
183
185
  # The specified probability, which the compiler guarantees to be a number in the range [0, 1]
184
186
  value: float
@@ -186,7 +188,7 @@ class ChanceExpression(TypedDict):
186
188
 
187
189
  class Comparison(NegatableExpression):
188
190
  """A Viv comparison, whereby two values are compared using a comparator."""
189
- # Discriminant for a Viv comparison
191
+ # Discriminator for a Viv comparison
190
192
  type: Literal[ExpressionDiscriminator.COMPARISON]
191
193
  # The actual expression value
192
194
  value: ComparisonValue
@@ -208,7 +210,7 @@ Comparator = Literal["==", ">", ">=", "<", "<=", "!="]
208
210
 
209
211
  class Conditional(TypedDict):
210
212
  """A Viv conditional expression, allowing for branching based on the value of a test."""
211
- # Discriminant for a Viv conditional
213
+ # Discriminator for a Viv conditional
212
214
  type: Literal[ExpressionDiscriminator.CONDITIONAL]
213
215
  # The actual expression value
214
216
  value: ConditionalValue
@@ -237,7 +239,7 @@ class Conjunction(NegatableExpression):
237
239
  This kind of expression takes multiple expressions as operands and evaluates to
238
240
  `True` if and only if all the respective expressions evaluate to truthy values.
239
241
  """
240
- # Discriminant for a Viv conjunction
242
+ # Discriminator for a Viv conjunction
241
243
  type: Literal[ExpressionDiscriminator.CONJUNCTION]
242
244
  # The actual expression value
243
245
  value: ConjunctionValue
@@ -257,7 +259,7 @@ class Disjunction(NegatableExpression):
257
259
  This kind which takes multiple expressions and evaluates to `True` if and only
258
260
  if at least one of the respective expressions evaluate to a truthy value.
259
261
  """
260
- # Discriminant for a Viv disjunction
262
+ # Discriminator for a Viv disjunction
261
263
  type: Literal[ExpressionDiscriminator.DISJUNCTION]
262
264
  # The actual expression value
263
265
  value: DisjunctionValue
@@ -272,39 +274,49 @@ class DisjunctionValue(TypedDict):
272
274
 
273
275
 
274
276
  class EntityReference(NegatableExpression):
275
- """A Viv entity reference, structured as an anchor role and a path to a specific property value.
277
+ """A Viv entity reference, structured as an anchor name and a (possibly empty) path to a specific property value.
276
278
 
277
- Usually, the property is on the entity cast into the anchor role, but this is not the case if
278
- the reference contains a pointer. For instance, `@person.boss->boss->traits.cruel` would return
279
- the value stored at the path `traits.cruel` on the boss of the boss of the entity cast in the
280
- anchor role `@person`.
279
+ Usually, the property is on the anchor entity, but this is not the case if the reference contains
280
+ a pointer. For instance, `@person.boss->boss->traits.cruel` would return the value stored at the
281
+ path `traits.cruel` on the boss of the boss of the entity cast in the anchor role `@person`.
281
282
 
282
- Note that the compiler currently prevents an author from anchoring an entity reference in a
283
- symbol role, which allows the interpreter to assume that the anchor role binds an entity.
283
+ Note that the compiler prevents an author from anchoring an entity reference in a symbol.
284
284
 
285
- Also note that references anchored in global variables, e.g. `$foo.bar.baz`, are compiled
286
- to entities anchored in role references -- this is because `$` is really just syntactic
287
- sugar for `@this.scratch.`.
285
+ Also note that references anchored in scratch variables, e.g. `$@foo.bar.baz`, are compiled
286
+ to entity references -- this is because `$` is really just syntactic sugar for `@this.scratch.`,
287
+ with the next sigil indicating the type of the scratch variable.
288
288
  """
289
- # Discriminant for a Viv reference
289
+ # Discriminator for a Viv entity reference
290
290
  type: Literal[ExpressionDiscriminator.ENTITY_REFERENCE]
291
291
  # The actual expression value
292
- value: EntityReferenceValue
292
+ value: ReferenceValue
293
293
 
294
294
 
295
- class EntityReferenceValue(TypedDict):
296
- """The actual expression value for a Viv entity reference."""
297
- # The name of the role that anchors this reference
298
- anchor: RoleName
299
- # If applicable, the path to a specified property value. If the reference is just to
300
- # the entity itself, this will be an empty list. Otherwise, it will specify a path
301
- # to a specific property value, either on that entity or another one (via a pointer).
295
+ class SymbolReference(NegatableExpression):
296
+ """A Viv symbol reference, structured as an anchor name and a (possibly empty) path to a specific property value."""
297
+ # Discriminator for a Viv symbol reference
298
+ type: Literal[ExpressionDiscriminator.SYMBOL_REFERENCE]
299
+ # The actual expression value
300
+ value: ReferenceValue
301
+
302
+
303
+ class ReferenceValue(TypedDict):
304
+ """The actual expression value for a Viv entity reference or symbol reference."""
305
+ # Whether the anchor is a local variable. This is a common pattern when an author loops over a role
306
+ # unpacking, where the members of the group role can only be referenced individually by setting each
307
+ # one to a local variable (the loop variable).
308
+ local: bool
309
+ # The name anchoring this reference
310
+ anchor: Union[RoleName, VariableName]
311
+ # If applicable, the path to a specified property value. If the reference is just to the entity
312
+ # or symbol itself, this will be an empty list. Otherwise, it will specify a path to a specific
313
+ # property value, either on that entity or symbol or another entity (via a pointer).
302
314
  path: list[ReferencePathComponent]
303
315
 
304
316
 
305
317
  class ReferencePathComponentPropertyName(TypedDict, total=False):
306
318
  """A component of a Viv reference path specifying a property to access."""
307
- # Discriminant for a property-name reference path component
319
+ # Discriminator for a property-name reference path component
308
320
  type: Literal[ReferencePathComponentDiscriminator.REFERENCE_PATH_COMPONENT_PROPERTY_NAME]
309
321
  # The name of the property to access
310
322
  name: str
@@ -315,7 +327,7 @@ class ReferencePathComponentPropertyName(TypedDict, total=False):
315
327
 
316
328
  class ReferencePathComponentPointer(TypedDict, total=False):
317
329
  """A component of a Viv reference path specifying a pointer to dereference."""
318
- # Discriminant for a pointer reference path component
330
+ # Discriminator for a pointer reference path component
319
331
  type: Literal[ReferencePathComponentDiscriminator.REFERENCE_PATH_COMPONENT_POINTER]
320
332
  # The name of the property to access in the entity data of the entity targeted by the pointer
321
333
  propertyName: str
@@ -330,7 +342,7 @@ class ReferencePathComponentLookup(TypedDict, total=False):
330
342
 
331
343
  The key/index can be specified by an arbitrary Viv expression.
332
344
  """
333
- # Discriminant for a lookup reference path component
345
+ # Discriminator for a lookup reference path component
334
346
  type: Literal[ReferencePathComponentDiscriminator.REFERENCE_PATH_COMPONENT_LOOKUP]
335
347
  # An expression that should evaluate to a valid property key (string or integer)
336
348
  key: Expression
@@ -341,11 +353,11 @@ class ReferencePathComponentLookup(TypedDict, total=False):
341
353
 
342
354
  class ReferencePathComponentDiscriminator(StrEnum):
343
355
  """Enum containing discriminators for the possible reference path components."""
344
- # Discriminant for a property-name reference path component
356
+ # Discriminator for a property-name reference path component
345
357
  REFERENCE_PATH_COMPONENT_PROPERTY_NAME = "referencePathComponentPropertyName"
346
- # Discriminant for a pointer reference path component
358
+ # Discriminator for a pointer reference path component
347
359
  REFERENCE_PATH_COMPONENT_POINTER = "referencePathComponentPointer"
348
- # Discriminant for a lookup reference path component
360
+ # Discriminator for a lookup reference path component
349
361
  REFERENCE_PATH_COMPONENT_LOOKUP = "referencePathComponentLookup"
350
362
 
351
363
 
@@ -362,7 +374,7 @@ class Enum(TypedDict):
362
374
 
363
375
  Enums are resolved by the target application at runtime.
364
376
  """
365
- # Discriminant for a Viv enum
377
+ # Discriminator for a Viv enum
366
378
  type: Literal[ExpressionDiscriminator.ENUM]
367
379
  # The actual expression value
368
380
  value: EnumValue
@@ -395,13 +407,13 @@ class EvalFailSafeField(TypedDict):
395
407
  A Viv author may specify an attempt to access a property that may not exist, safely,
396
408
  via the eval fail-safe operator `?`, as in this example: `@foo.bar?.baz`.
397
409
  """
398
- # Discriminant for the Viv eval fail-safe operator
410
+ # Discriminator for the Viv eval fail-safe operator
399
411
  type: Literal[ExpressionDiscriminator.EVAL_FAIL_SAFE]
400
412
 
401
413
 
402
414
  class FloatField(TypedDict):
403
415
  """A Viv floating-point number."""
404
- # Discriminant for a Viv floating-point number
416
+ # Discriminator for a Viv floating-point number
405
417
  type: Literal[ExpressionDiscriminator.FLOAT]
406
418
  # The float literal to which this expression will evaluate
407
419
  value: float
@@ -409,7 +421,7 @@ class FloatField(TypedDict):
409
421
 
410
422
  class IntField(TypedDict):
411
423
  """A Viv integer."""
412
- # Discriminant for a Viv integer
424
+ # Discriminator for a Viv integer
413
425
  type: Literal[ExpressionDiscriminator.INT]
414
426
  # The integer literal to which this expression will evaluate
415
427
  value: int
@@ -420,38 +432,15 @@ class ListField(TypedDict):
420
432
 
421
433
  Once evaluated, the result will contain the respective evaluations of the expressions, in that same order.
422
434
  """
423
- # Discriminant for a Viv list
435
+ # Discriminator for a Viv list
424
436
  type: Literal[ExpressionDiscriminator.LIST]
425
437
  # The actual expression value
426
438
  value: list[Expression]
427
439
 
428
440
 
429
- class LocalVariableReference(NegatableExpression):
430
- """A Viv local-variable reference, meaning a reference anchored in a local variable.
431
-
432
- This kind of expression is structured as an anchor (the local variable name) with a subsequent path
433
- to a specific property value. If a local variable is bound to an entity, this works just like an
434
- entity reference — common when looping over role unpackings. Local variables may, however, hold
435
- arbitrary values to which authors can refer.
436
- """
437
- # Discriminant for a Viv local-variable reference
438
- type: Literal[ExpressionDiscriminator.LOCAL_VARIABLE_REFERENCE]
439
- # The actual expression value
440
- value: LocalVariableReferenceValue
441
-
442
-
443
- class LocalVariableReferenceValue(TypedDict):
444
- """The actual expression value for a Viv local-variable reference."""
445
- # The name of the local variable that anchors this reference
446
- anchor: VariableName
447
- # If applicable, the path to a specified property value. If the reference is just to the
448
- # variable's value itself, this will be an empty list. Otherwise, it specifies the path.
449
- path: list[ReferencePathComponent]
450
-
451
-
452
441
  class Loop(TypedDict):
453
442
  """A Viv loop, allowing for iteration over some iterable value."""
454
- # Discriminant for a Viv loop
443
+ # Discriminator for a Viv loop
455
444
  type: Literal[ExpressionDiscriminator.LOOP]
456
445
  # The actual expression value
457
446
  value: LoopValue
@@ -461,15 +450,22 @@ class LoopValue(TypedDict):
461
450
  """The actual expression value for a Viv loop."""
462
451
  # An expression that should evaluate to a value that is iterable in the runtime at hand.
463
452
  iterable: Expression
464
- # Name of the variable to which each member of the iterable is assigned
465
- # on its respective iteration of the loop.
466
- variable: VariableName
453
+ # The local variable to which each member of the iterable is assigned on its respective iteration of the loop
454
+ variable: LocalVariable
467
455
  # The body of the loop, structured as a list of expressions that will each be interpreted,
468
456
  # in order, on each iteration. These body expressions can reference the loop variable,
469
457
  # allowing for Viv code that acts on each member of an iterable.
470
458
  body: list[Expression]
471
459
 
472
460
 
461
+ class LocalVariable(TypedDict):
462
+ """A Viv local variable."""
463
+ # The name of the local variable
464
+ name: VariableName
465
+ # Whether the variable is marked as binding an entity (as opposed to a symbol)
466
+ isEntityVariable: bool
467
+
468
+
473
469
  # The name for a variable used in an assignment or a loop
474
470
  VariableName = str
475
471
 
@@ -480,7 +476,7 @@ class MembershipTest(NegatableExpression):
480
476
  This kind of expression takes two expressions as operands and evaluates to `True` if the evaluation
481
477
  of the first expression is a member of the (iterable) evaluation of the second expression.
482
478
  """
483
- # Discriminant for a Viv membership test
479
+ # Discriminator for a Viv membership test
484
480
  type: Literal[ExpressionDiscriminator.MEMBERSHIP_TEST]
485
481
  # The actual expression value
486
482
  value: MembershipTestValue
@@ -500,7 +496,7 @@ class MembershipTestValue(TypedDict):
500
496
 
501
497
  class NullField(TypedDict):
502
498
  """A Viv null value."""
503
- # Discriminant for a Viv null value
499
+ # Discriminator for a Viv null value
504
500
  type: Literal[ExpressionDiscriminator.NULL_TYPE]
505
501
  # Python's `None`, which serializes to JSON's `null`. In any Viv runtime, expressions of this
506
502
  # type evaluate to the null-like value in the language at hand.
@@ -513,7 +509,7 @@ class ObjectField(TypedDict):
513
509
  Expressions of this type maps keys (string literals) to Viv expressions. Once evaluated,
514
510
  the result will map those same keys to the respective evaluations of the Viv expressions.
515
511
  """
516
- # Discriminant for a Viv object literal
512
+ # Discriminator for a Viv object literal
517
513
  type: Literal[ExpressionDiscriminator.OBJECT]
518
514
  # The actual expression value
519
515
  value: dict[str, "Expression"]
@@ -526,7 +522,7 @@ class RoleUnpacking(TypedDict):
526
522
  that role. This allows for iterating over multiple entities cast into the same role, e.g.,
527
523
  to carry out effects on each.
528
524
  """
529
- # Discriminant for a Viv role-unpacking expression
525
+ # Discriminator for a Viv role-unpacking expression
530
526
  type: Literal[ExpressionDiscriminator.ROLE_UNPACKING]
531
527
  # The actual expression value
532
528
  value: RoleName
@@ -534,7 +530,7 @@ class RoleUnpacking(TypedDict):
534
530
 
535
531
  class StringField(TypedDict):
536
532
  """A Viv string literal."""
537
- # Discriminant for a Viv string literal
533
+ # Discriminator for a Viv string literal
538
534
  type: Literal[ExpressionDiscriminator.STRING]
539
535
  # The string literal to which this expression will evaluate
540
536
  value: str
@@ -546,10 +542,10 @@ class TemplateStringField(TypedDict):
546
542
  This kind of expression is structured as an ordered list of string literals and string-producing
547
543
  references, the evaluations of which are concatenated to form the rendered string.
548
544
  """
549
- # Discriminant for a Viv templated string
545
+ # Discriminator for a Viv templated string
550
546
  type: Literal[ExpressionDiscriminator.TEMPLATE_STRING]
551
547
  # The actual expression value
552
- value: list[Union[str, EntityReference, RoleUnpacking, LocalVariableReference]]
548
+ value: list[Union[str, EntityReference, SymbolReference, RoleUnpacking]]
553
549
 
554
550
 
555
551
  class TropeFitExpression(NegatableExpression):
@@ -557,7 +553,7 @@ class TropeFitExpression(NegatableExpression):
557
553
 
558
554
  This kind of expression evaluates to `True` if the trope holds with the given arguments.
559
555
  """
560
- # Discriminant for a Viv trope-fit expression
556
+ # Discriminator for a Viv trope-fit expression
561
557
  type: Literal[ExpressionDiscriminator.TROPE_FIT_EXPRESSION]
562
558
  # The actual expression value
563
559
  value: TropeFitExpressionValue