summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2020-09-09 07:42:45 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2020-09-09 07:42:45 +0200
commitdd6d05fa12e64b133326695f6fa77d8e989d2610 (patch)
treece7688ff7a52f1f11ae2a5a859bd8703de954490
parentc6642fdc7b7aae352d5fa5478bad2f4369b4f8b9 (diff)
...
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/AddElementAtComputation.java84
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/AddElementComputation.java83
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/AddElementsOfComputation.java85
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/MapComputation.java93
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/Range.java (renamed from src/core/src/tonkadur/fate/v1/lang/instruction/Range.java)0
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/RemoveAllOfElementComputation.java84
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementAtComputation.java141
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementComputation.java166
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/ReverseListComputation.java101
-rw-r--r--src/core/src/tonkadur/fate/v1/lang/computation/ShuffleComputation.java101
-rw-r--r--src/core/src/tonkadur/fate/v1/parser/FateLexer.g420
-rw-r--r--src/core/src/tonkadur/fate/v1/parser/FateParser.g4374
12 files changed, 1294 insertions, 38 deletions
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/AddElementAtComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/AddElementAtComputation.java
new file mode 100644
index 0000000..b34b293
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/AddElementAtComputation.java
@@ -0,0 +1,84 @@
+package tonkadur.fate.v1.lang.computation;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.fate.v1.error.ConflictingTypeException;
+import tonkadur.fate.v1.error.IncomparableTypeException;
+import tonkadur.fate.v1.error.InvalidTypeException;
+
+import tonkadur.fate.v1.lang.instruction.AddElementAt;
+
+import tonkadur.fate.v1.lang.meta.ComputationVisitor;
+import tonkadur.fate.v1.lang.meta.Computation;
+
+public class AddElementAtComputation extends Computation
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final AddElementAt instruction;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected AddElementAtComputation
+ (
+ final AddElementAt instruction
+ )
+ {
+ super(instruction.get_origin(), instruction.get_collection().get_type());
+
+ this.instruction = instruction;
+ }
+
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static AddElementAtComputation build
+ (
+ final Origin origin,
+ final Computation index,
+ final Computation element,
+ final Computation collection
+ )
+ throws
+ InvalidTypeException,
+ ConflictingTypeException,
+ IncomparableTypeException
+ {
+ return
+ new AddElementAtComputation
+ (
+ AddElementAt.build(origin, index, element, collection)
+ );
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final ComputationVisitor cv)
+ throws Throwable
+ {
+ cv.visit_add_element_at(this);
+ }
+
+ public AddElementAt get_instruction ()
+ {
+ return instruction;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append("(ComputationOf ");
+ sb.append(instruction.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+}
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/AddElementComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/AddElementComputation.java
new file mode 100644
index 0000000..e0ef551
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/AddElementComputation.java
@@ -0,0 +1,83 @@
+package tonkadur.fate.v1.lang.computation;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.fate.v1.error.ConflictingTypeException;
+import tonkadur.fate.v1.error.IncomparableTypeException;
+import tonkadur.fate.v1.error.InvalidTypeException;
+
+import tonkadur.fate.v1.lang.instruction.AddElement;
+
+import tonkadur.fate.v1.lang.meta.ComputationVisitor;
+import tonkadur.fate.v1.lang.meta.Computation;
+
+public class AddElementComputation extends Computation
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final AddElement instruction;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected AddElementComputation
+ (
+ final AddElementAt instruction
+ )
+ {
+ super(instruction.get_origin(), instruction.get_collection().get_type());
+
+ this.instruction = instruction;
+ }
+
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static AddElementComputation build
+ (
+ final Origin origin,
+ final Computation element,
+ final Computation collection
+ )
+ throws
+ InvalidTypeException,
+ ConflictingTypeException,
+ IncomparableTypeException
+ {
+ return
+ new AddElementComputation
+ (
+ AddElement.build(origin, element, collection)
+ );
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final ComputationVisitor cv)
+ throws Throwable
+ {
+ cv.visit_add_element(this);
+ }
+
+ public AddElement get_instruction ()
+ {
+ return instruction;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append("(ComputationOf ");
+ sb.append(instruction.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+}
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/AddElementsOfComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/AddElementsOfComputation.java
new file mode 100644
index 0000000..5d87e0b
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/AddElementsOfComputation.java
@@ -0,0 +1,85 @@
+package tonkadur.fate.v1.lang.computation;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.fate.v1.error.ConflictingTypeException;
+import tonkadur.fate.v1.error.IncomparableTypeException;
+import tonkadur.fate.v1.error.InvalidTypeException;
+
+import tonkadur.fate.v1.lang.instruction.AddElementsOf;
+
+import tonkadur.fate.v1.lang.meta.ComputationVisitor;
+import tonkadur.fate.v1.lang.meta.Computation;
+import tonkadur.fate.v1.lang.meta.Reference;
+
+public class AddElementsOfComputation extends Computation
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final AddElementsOf instruction;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected AddElementsOfComputation
+ (
+ final AddElementsOf instruction
+ )
+ {
+ super(instruction.get_origin(), instruction.get_collection().get_type());
+
+ this.instruction = instruction;
+ }
+
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static AddElementsOfComputation build
+ (
+ final Origin origin,
+ final Reference other_collection,
+ final Reference collection
+ )
+ throws
+ InvalidTypeException,
+ ConflictingTypeException,
+ IncomparableTypeException
+ {
+ return
+ new AddElementsOfComputation
+ (
+ AddElementsOf.build(origin, other_collection, collection)
+ );
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final ComputationVisitor cv)
+ throws Throwable
+ {
+ cv.visit_add_elements_of(this);
+ }
+
+ public AddElementsOf get_instruction ()
+ {
+ return instruction;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append("(ComputationOf ");
+ sb.append(instruction.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+
+}
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/MapComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/MapComputation.java
new file mode 100644
index 0000000..9ca1042
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/MapComputation.java
@@ -0,0 +1,93 @@
+package tonkadur.fate.v1.lang.computation;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.error.ErrorManager;
+
+import tonkadur.fate.v1.lang.type.Type;
+import tonkadur.fate.v1.lang.type.LambdaType;
+import tonkadur.fate.v1.lang.type.CollectionType;
+
+import tonkadur.fate.v1.lang.instruction.Map;
+
+import tonkadur.fate.v1.lang.meta.Computation;
+import tonkadur.fate.v1.lang.meta.ComputationVisitor;
+import tonkadur.fate.v1.lang.meta.Reference;
+
+public class MapComputation extends Computation
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final Map instruction;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected MapComputation
+ (
+ final Map instruction,
+ final Type output_type
+ )
+ {
+ super(instruction.get_origin(), output_type);
+
+ this.instruction = instruction;
+ }
+
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static MapComputation build
+ (
+ final Origin origin,
+ final Computation lambda_function,
+ final Reference collection_in
+ )
+ throws Throwable
+ {
+ final Type type;
+ final Map parent;
+
+ parent = Map.build(origin, lambda_function, collection_in, null);
+
+ type =
+ CollectionType.build
+ (
+ origin,
+ ((LambdaType) lambda_function.get_type()).get_return_type(),
+ ((CollectionType) collection_in.get_type()).is_set()
+ );
+
+ return new MapComputation(parent, type);
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final ComputationVisitor cv)
+ throws Throwable
+ {
+ cv.visit_map(this);
+ }
+
+ public Map get_instruction ()
+ {
+ return instruction;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append("(ComputationOf ");
+ sb.append(instruction.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+}
diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/Range.java b/src/core/src/tonkadur/fate/v1/lang/computation/Range.java
index 2398bdf..2398bdf 100644
--- a/src/core/src/tonkadur/fate/v1/lang/instruction/Range.java
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/Range.java
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveAllOfElementComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveAllOfElementComputation.java
new file mode 100644
index 0000000..dc6bdf5
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveAllOfElementComputation.java
@@ -0,0 +1,84 @@
+package tonkadur.fate.v1.lang.computation;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.fate.v1.error.ConflictingTypeException;
+import tonkadur.fate.v1.error.IncomparableTypeException;
+import tonkadur.fate.v1.error.InvalidTypeException;
+
+import tonkadur.fate.v1.lang.instruction.RemoveAllOfElement;
+
+import tonkadur.fate.v1.lang.meta.ComputationVisitor;
+import tonkadur.fate.v1.lang.meta.Computation;
+import tonkadur.fate.v1.lang.meta.Computation;
+import tonkadur.fate.v1.lang.meta.Reference;
+
+public class RemoveAllOfElementComputation extends Computation
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final RemoveAllOfElement instruction;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected RemoveAllOfElementComputation
+ (
+ final RemoveAllOfElement instruction
+ )
+ {
+ super(instruction.get_origin(), instruction.get_collection().get_type());
+
+ this.instruction = instruction;
+ }
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static RemoveAllOfElementComputation build
+ (
+ final Origin origin,
+ final Computation element,
+ final Reference collection
+ )
+ throws
+ InvalidTypeException,
+ ConflictingTypeException,
+ IncomparableTypeException
+ {
+ return
+ new RemoveAllOfElementComputation
+ (
+ RemoveAllOfElement.build(origin, element, collection)
+ );
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final ComputationVisitor cv)
+ throws Throwable
+ {
+ cv.visit_remove_all_of_element(this);
+ }
+
+ public RemoveAllOfElement get_instruction ()
+ {
+ return instruction;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append("(ComputationOf ");
+ sb.append(instruction.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+}
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementAtComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementAtComputation.java
new file mode 100644
index 0000000..3bf0104
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementAtComputation.java
@@ -0,0 +1,141 @@
+package tonkadur.fate.v1.lang.instruction;
+
+import tonkadur.error.ErrorManager;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.fate.v1.error.IncomparableTypeException;
+import tonkadur.fate.v1.error.InvalidTypeException;
+
+import tonkadur.fate.v1.lang.type.CollectionType;
+import tonkadur.fate.v1.lang.type.Type;
+
+import tonkadur.fate.v1.lang.meta.InstructionVisitor;
+import tonkadur.fate.v1.lang.meta.Instruction;
+import tonkadur.fate.v1.lang.meta.Computation;
+import tonkadur.fate.v1.lang.meta.Reference;
+
+public class RemoveElementAt extends Instruction
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final Computation index;
+ protected final Reference collection;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected RemoveElementAt
+ (
+ final Origin origin,
+ final Computation index,
+ final Reference collection
+ )
+ {
+ super(origin);
+
+ this.collection = collection;
+ this.index = index;
+ }
+
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static RemoveElementAt build
+ (
+ final Origin origin,
+ final Computation index,
+ final Reference collection
+ )
+ throws
+ InvalidTypeException,
+ IncomparableTypeException
+ {
+ final Type collection_type, hint;
+
+ collection_type = collection.get_type();
+
+ if (!(collection_type instanceof CollectionType))
+ {
+ ErrorManager.handle
+ (
+ new InvalidTypeException
+ (
+ collection.get_origin(),
+ collection.get_type(),
+ Type.COLLECTION_TYPES
+ )
+ );
+ }
+
+ if (index.get_type().can_be_used_as(Type.INT))
+ {
+ return new RemoveElementAt(origin, index, collection);
+ }
+
+ hint =
+ (Type) index.get_type().generate_comparable_to(Type.INT);
+
+ if (hint.equals(Type.ANY))
+ {
+ ErrorManager.handle
+ (
+ new IncomparableTypeException
+ (
+ index.get_origin(),
+ index.get_type(),
+ Type.INT
+ )
+ );
+ }
+
+ return new RemoveElementAt(origin, index, collection);
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final InstructionVisitor iv)
+ throws Throwable
+ {
+ iv.visit_remove_element_at(this);
+ }
+
+ public Computation get_index ()
+ {
+ return index;
+ }
+
+ public Reference get_collection ()
+ {
+ return collection;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append(origin.toString());
+ sb.append("(RemoveElementAt");
+ sb.append(System.lineSeparator());
+ sb.append(System.lineSeparator());
+
+ sb.append("index:");
+ sb.append(System.lineSeparator());
+ sb.append(index.toString());
+ sb.append(System.lineSeparator());
+ sb.append(System.lineSeparator());
+
+ sb.append("collection:");
+ sb.append(System.lineSeparator());
+ sb.append(collection.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+}
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementComputation.java
new file mode 100644
index 0000000..d721614
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/RemoveElementComputation.java
@@ -0,0 +1,166 @@
+package tonkadur.fate.v1.lang.instruction;
+
+import tonkadur.error.ErrorManager;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.fate.v1.error.ConflictingTypeException;
+import tonkadur.fate.v1.error.IncomparableTypeException;
+import tonkadur.fate.v1.error.InvalidTypeException;
+
+import tonkadur.fate.v1.lang.type.CollectionType;
+import tonkadur.fate.v1.lang.type.Type;
+
+import tonkadur.fate.v1.lang.meta.InstructionVisitor;
+import tonkadur.fate.v1.lang.meta.Instruction;
+import tonkadur.fate.v1.lang.meta.Computation;
+
+public class RemoveElement extends Instruction
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final Computation element;
+ protected final Computation collection;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected RemoveElement
+ (
+ final Origin origin,
+ final Computation element,
+ final Computation collection
+ )
+ {
+ super(origin);
+
+ this.collection = collection;
+ this.element = element;
+ }
+
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static RemoveElement build
+ (
+ final Origin origin,
+ final Computation element,
+ final Computation collection
+ )
+ throws
+ InvalidTypeException,
+ ConflictingTypeException,
+ IncomparableTypeException
+ {
+ final Type hint;
+ final Type collection_type;
+ final CollectionType collection_true_type;
+ final Type collection_element_type;
+
+ collection_type = collection.get_type();
+
+ if (!(collection_type instanceof CollectionType))
+ {
+ ErrorManager.handle
+ (
+ new InvalidTypeException
+ (
+ collection.get_origin(),
+ collection.get_type(),
+ Type.COLLECTION_TYPES
+ )
+ );
+ }
+
+ collection_true_type = (CollectionType) collection_type;
+ collection_element_type = collection_true_type.get_content_type();
+
+ if
+ (
+ element.get_type().can_be_used_as(collection_element_type)
+ ||
+ (element.get_type().try_merging_with(collection_element_type) != null)
+ )
+ {
+ return new RemoveElement(origin, element, collection);
+ }
+
+ ErrorManager.handle
+ (
+ new ConflictingTypeException
+ (
+ element.get_origin(),
+ element.get_type(),
+ collection_element_type
+ )
+ );
+
+ hint =
+ (Type) element.get_type().generate_comparable_to
+ (
+ collection_element_type
+ );
+
+ if (hint.equals(Type.ANY))
+ {
+ ErrorManager.handle
+ (
+ new IncomparableTypeException
+ (
+ element.get_origin(),
+ element.get_type(),
+ collection_element_type
+ )
+ );
+ }
+
+ return new RemoveElement(origin, element, collection);
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final InstructionVisitor iv)
+ throws Throwable
+ {
+ iv.visit_remove_element(this);
+ }
+
+ public Computation get_element ()
+ {
+ return element;
+ }
+
+ public Computation get_collection ()
+ {
+ return collection;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append(origin.toString());
+ sb.append("(RemoveElement");
+ sb.append(System.lineSeparator());
+ sb.append(System.lineSeparator());
+
+ sb.append("element:");
+ sb.append(System.lineSeparator());
+ sb.append(element.toString());
+ sb.append(System.lineSeparator());
+ sb.append(System.lineSeparator());
+
+ sb.append("collection:");
+ sb.append(System.lineSeparator());
+ sb.append(collection.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+}
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/ReverseListComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/ReverseListComputation.java
new file mode 100644
index 0000000..59a68e6
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/ReverseListComputation.java
@@ -0,0 +1,101 @@
+package tonkadur.fate.v1.lang.instruction;
+
+import java.util.Collections;
+
+import tonkadur.error.ErrorManager;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.fate.v1.error.InvalidTypeException;
+
+import tonkadur.fate.v1.lang.type.CollectionType;
+import tonkadur.fate.v1.lang.type.Type;
+
+import tonkadur.fate.v1.lang.meta.InstructionVisitor;
+import tonkadur.fate.v1.lang.meta.Instruction;
+import tonkadur.fate.v1.lang.meta.Computation;
+
+public class ReverseList extends Instruction
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final Computation collection;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected ReverseList
+ (
+ final Origin origin,
+ final Computation collection
+ )
+ {
+ super(origin);
+
+ this.collection = collection;
+ }
+
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static ReverseList build
+ (
+ final Origin origin,
+ final Computation collection
+ )
+ throws InvalidTypeException
+ {
+ final Type t;
+
+ t = collection.get_type();
+
+ if
+ (
+ !(t instanceof CollectionType)
+ || ((CollectionType) t).is_set()
+ )
+ {
+ ErrorManager.handle
+ (
+ new InvalidTypeException
+ (
+ collection.get_origin(),
+ collection.get_type(),
+ Collections.singleton(Type.LIST)
+ )
+ );
+ }
+
+ return new ReverseList(origin, collection);
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final InstructionVisitor iv)
+ throws Throwable
+ {
+ iv.visit_reverse_list(this);
+ }
+
+ public Computation get_collection ()
+ {
+ return collection;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append("(ReverseList ");
+ sb.append(collection.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+}
diff --git a/src/core/src/tonkadur/fate/v1/lang/computation/ShuffleComputation.java b/src/core/src/tonkadur/fate/v1/lang/computation/ShuffleComputation.java
new file mode 100644
index 0000000..ebac30e
--- /dev/null
+++ b/src/core/src/tonkadur/fate/v1/lang/computation/ShuffleComputation.java
@@ -0,0 +1,101 @@
+package tonkadur.fate.v1.lang.instruction;
+
+import java.util.Collections;
+
+import tonkadur.error.ErrorManager;
+
+import tonkadur.parser.Origin;
+
+import tonkadur.fate.v1.error.InvalidTypeException;
+
+import tonkadur.fate.v1.lang.type.CollectionType;
+import tonkadur.fate.v1.lang.type.Type;
+
+import tonkadur.fate.v1.lang.meta.InstructionVisitor;
+import tonkadur.fate.v1.lang.meta.Instruction;
+import tonkadur.fate.v1.lang.meta.Computation;
+
+public class Shuffle extends Instruction
+{
+ /***************************************************************************/
+ /**** MEMBERS **************************************************************/
+ /***************************************************************************/
+ protected final Computation collection;
+
+ /***************************************************************************/
+ /**** PROTECTED ************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ protected Shuffle
+ (
+ final Origin origin,
+ final Computation collection
+ )
+ {
+ super(origin);
+
+ this.collection = collection;
+ }
+
+ /***************************************************************************/
+ /**** PUBLIC ***************************************************************/
+ /***************************************************************************/
+ /**** Constructors *********************************************************/
+ public static Shuffle build
+ (
+ final Origin origin,
+ final Computation collection
+ )
+ throws InvalidTypeException
+ {
+ final Type t;
+
+ t = collection.get_type();
+
+ if
+ (
+ !(t instanceof CollectionType)
+ || ((CollectionType) t).is_set()
+ )
+ {
+ ErrorManager.handle
+ (
+ new InvalidTypeException
+ (
+ collection.get_origin(),
+ collection.get_type(),
+ Collections.singleton(Type.LIST)
+ )
+ );
+ }
+
+ return new Shuffle(origin, collection);
+ }
+
+ /**** Accessors ************************************************************/
+ @Override
+ public void get_visited_by (final InstructionVisitor iv)
+ throws Throwable
+ {
+ iv.visit_shuffle(this);
+ }
+
+ public Computation get_collection ()
+ {
+ return collection;
+ }
+
+ /**** Misc. ****************************************************************/
+ @Override
+ public String toString ()
+ {
+ final StringBuilder sb = new StringBuilder();
+
+ sb.append("(Shuffle ");
+ sb.append(collection.toString());
+
+ sb.append(")");
+
+ return sb.toString();
+ }
+}
diff --git a/src/core/src/tonkadur/fate/v1/parser/FateLexer.g4 b/src/core/src/tonkadur/fate/v1/parser/FateLexer.g4
index 3ac7851..09e417e 100644
--- a/src/core/src/tonkadur/fate/v1/parser/FateLexer.g4
+++ b/src/core/src/tonkadur/fate/v1/parser/FateLexer.g4
@@ -17,8 +17,11 @@ R_PAREN: ')';
ABS_KW: L_PAREN 'abs'('olute'?) SEP+;
ACCESS_KW: L_PAREN 'access' SEP+;
ADD_KW: L_PAREN 'add'(US'element')? SEP+;
+IMP_ADD_KW: L_PAREN 'add'(US'element')?'!' SEP+;
ADD_AT_KW: L_PAREN 'add'(US'element')?US'at' SEP+;
+IMP_ADD_AT_KW: L_PAREN 'add'(US'element')?US'at!' SEP+;
ADD_ALL_KW: L_PAREN 'add'US'all'(US'elements')? SEP+;
+IMP_ADD_ALL_KW: L_PAREN 'add'US'all'(US'elements')?'!' SEP+;
AND_KW: L_PAREN ('and'|'/\\') SEP+;
ASSERT_KW: L_PAREN 'assert' SEP+;
AT_KW: L_PAREN 'at' SEP+;
@@ -53,6 +56,7 @@ IGNORE_ERROR_KW: L_PAREN 'ignore'US('error'|'warning') SEP+;
FATE_VERSION_KW: L_PAREN 'fate'US'version' SEP+;
FIELD_KW: L_PAREN 'field' SEP+;
FILTER_KW: L_PAREN 'filter' SEP+;
+IMP_FILTER_KW: L_PAREN 'filter!' SEP+;
FOR_EACH_KW: L_PAREN ('for'US'each') SEP+;
FOR_KW: L_PAREN 'for' SEP+;
FOLDR_KW: L_PAREN 'foldr' SEP+;
@@ -66,6 +70,7 @@ IMPLIES_KW: L_PAREN ('implies'|'=>'|'->') SEP+;
INCLUDE_KW: L_PAREN 'include' SEP+;
INDEX_OF_KW: L_PAREN ('index'US'of') SEP+;
INDEXED_MAP_KW: L_PAREN 'indexed'US'map' SEP+;
+IMP_INDEXED_MAP_KW: L_PAREN 'indexed'US'map!' SEP+;
IS_MEMBER_KW: L_PAREN ('is'US'member'|'contains'|'has') SEP+;
IS_EMPTY_KW: L_PAREN 'is'US'empty' SEP+;
LOWER_EQUAL_THAN_KW: L_PAREN ('lower'US'equal'US'than'|'=<'|'<='|'le') SEP+;
@@ -74,12 +79,14 @@ LET_KW: L_PAREN 'let' SEP+;
MINUS_KW: L_PAREN ('minus'|'-') SEP+;
MIN_KW: L_PAREN ('min'('imum'?)) SEP+;
MAP_KW: L_PAREN 'map' SEP+;
+IMP_MAP_KW: L_PAREN 'map!' SEP+;
MAX_KW: L_PAREN ('max'('imum'?)) SEP+;
LAMBDA_KW: L_PAREN 'lambda' SEP+;
EVAL_KW: L_PAREN 'eval'('uate'?) SEP+;
CLAMP_KW: L_PAREN ('clamp') SEP+;
MODULO_KW: L_PAREN ('modulo'|'%'|'mod') SEP+;
MERGE_KW : L_PAREN 'merge' SEP+;
+IMP_MERGE_KW : L_PAREN 'merge!' SEP+;
NEWLINE_KW: L_PAREN 'newline)';
NEW_KW: L_PAREN ('new'|'reserve'|'create') SEP+;
NOT_KW: L_PAREN ('not'|'~'|'!') SEP+;
@@ -87,10 +94,15 @@ ONE_IN_KW: L_PAREN ('exactly'US)?'one'(US'in')? SEP+;
OR_KW: L_PAREN ('or'|'\\/') SEP+;
RICH_TEXT_KW: L_PAREN (('rich'US)?'text') SEP+;
PARTITION_KW: L_PAREN 'partition' SEP+;
+IMP_PARTITION_KW: L_PAREN 'partition!' SEP+;
POP_LEFT: L_PAREN 'pop'US'left' SEP+;
+IMP_POP_LEFT: L_PAREN 'pop'US'left!' SEP+;
POP_RIGHT: L_PAREN 'pop'US'right' SEP+;
+IMP_POP_RIGHT: L_PAREN 'pop'US'right!' SEP+;
PUSH_LEFT: L_PAREN 'push'US'left' SEP+;
+IMP_PUSH_LEFT: L_PAREN 'push'US'left!' SEP+;
PUSH_RIGHT: L_PAREN 'push'US'right' SEP+;
+IMP_PUSH_RIGHT: L_PAREN 'push'US'right!' SEP+;
PLAYER_CHOICE_KW: L_PAREN ('choice'|'user'US'choice'|'player'US'choice') SEP+;
PLUS_KW: L_PAREN ('plus'|'+') SEP+;
POWER_KW: L_PAREN ('power'|'^'|'**'|'pow') SEP+;
@@ -98,18 +110,26 @@ RANGE_KW: L_PAREN 'range' SEP+;
RANDOM_KW: L_PAREN ('random'|'rand'|'rnd') SEP+;
REF_KW: L_PAREN (((('ref'('erence'?))|'ptr'|'pointer')(US'to')?)|('address'(US'of'))) SEP+;
REMOVE_ALL_KW: L_PAREN 'remove'US'all' SEP+;
+IMP_REMOVE_ALL_KW: L_PAREN 'remove'US'all!' SEP+;
REVERSE_KW: L_PAREN 'reverse'(US'list')? SEP+;
+IMP_REVERSE_KW: L_PAREN 'reverse'(US'list')?'!' SEP+;
REMOVE_ONE_KW: L_PAREN 'remove'US'one' SEP+;
+IMP_REMOVE_ONE_KW: L_PAREN 'remove'US'one!' SEP+;
REMOVE_AT_KW: L_PAREN ('remove'US('elem'('ent')?US)?'at') SEP+;
+IMP_REMOVE_AT_KW: L_PAREN ('remove'US('elem'('ent')?US)?'at!') SEP+;
REQUIRE_EXTENSION_KW: L_PAREN 'require'US'extension' SEP+;
REQUIRE_KW: L_PAREN 'require' SEP+;
PROMPT_STRING_KW: L_PAREN 'prompt_string' SEP+;
PROMPT_INTEGER_KW: L_PAREN 'prompt_int'('eger'?) SEP+;
SHUFFLE_KW: L_PAREN 'shuffle' SEP+;
+IMP_SHUFFLE_KW: L_PAREN 'shuffle!' SEP+;
SORT_KW: L_PAREN 'sort' SEP+;
+IMP_SORT_KW: L_PAREN 'sort!' SEP+;
SET_FIELDS_KW: L_PAREN 'set'US'fields' SEP+;
+IMP_SET_FIELDS_KW: L_PAREN 'set'US'fields!' SEP+;
SET_KW: L_PAREN 'set'(US(('val''ue'?)|('var''iable'?)))? SEP+;
SUB_LIST_KW: L_PAREN 'sub'US'list' SEP+;
+IMP_SUB_LIST_KW: L_PAREN 'sub'US'list!' SEP+;
LIST_KW: L_PAREN 'list' SEP+;
SIZE_KW: L_PAREN 'size' SEP+;
SWITCH_KW: L_PAREN 'switch' SEP+;
diff --git a/src/core/src/tonkadur/fate/v1/parser/FateParser.g4 b/src/core/src/tonkadur/fate/v1/parser/FateParser.g4
index 89ab79d..a94736d 100644
--- a/src/core/src/tonkadur/fate/v1/parser/FateParser.g4
+++ b/src/core/src/tonkadur/fate/v1/parser/FateParser.g4
@@ -578,7 +578,7 @@ returns [Instruction result]
);
}
- | ADD_KW value WS+ value_reference WS* R_PAREN
+ | IMP_ADD_KW value WS+ value_reference WS* R_PAREN
{
$result =
AddElement.build
@@ -593,7 +593,7 @@ returns [Instruction result]
);
}
- | ADD_AT_KW index=value WS+ element=value WS+ value_reference WS* R_PAREN
+ | IMP_ADD_AT_KW index=value WS+ element=value WS+ value_reference WS* R_PAREN
{
$result =
AddElementAt.build
@@ -609,7 +609,10 @@ returns [Instruction result]
);
}
- | ADD_ALL_KW source=value_reference WS+ target=value_reference WS* R_PAREN
+ | IMP_ADD_ALL_KW
+ source=value_reference WS+
+ target=value_reference WS*
+ R_PAREN
{
$result =
AddElementsOf.build
@@ -656,7 +659,10 @@ returns [Instruction result]
$result = ($general_fate_instr.result);
}
- | REMOVE_ONE_KW value WS+ value_reference WS* R_PAREN
+ | IMP_REMOVE_ONE_KW
+ value WS+
+ value_reference WS*
+ R_PAREN
{
$result =
RemoveElement.build
@@ -671,7 +677,10 @@ returns [Instruction result]
);
}
- | REMOVE_AT_KW value WS+ value_reference WS* R_PAREN
+ | IMP_REMOVE_AT_KW
+ value WS+
+ value_reference WS*
+ R_PAREN
{
$result =
RemoveElementAt.build
@@ -686,7 +695,10 @@ returns [Instruction result]
);
}
- | REMOVE_ALL_KW value WS+ value_reference WS* R_PAREN
+ | IMP_REMOVE_ALL_KW
+ value WS+
+ value_reference WS*
+ R_PAREN
{
$result =
RemoveAllOfElement.build
@@ -715,7 +727,7 @@ returns [Instruction result]
);
}
- | REVERSE_KW value_reference WS* R_PAREN
+ | IMP_REVERSE_KW value_reference WS* R_PAREN
{
$result =
ReverseList.build
@@ -729,7 +741,11 @@ returns [Instruction result]
);
}
- | MAP_KW value WS+ inr=value_reference WS+ outr=value_reference WS* R_PAREN
+ | IMP_MAP_KW
+ value WS+
+ inr=value_reference WS+
+ outr=value_reference WS*
+ R_PAREN
{
$result =
tonkadur.fate.v1.lang.instruction.Map.build
@@ -745,7 +761,7 @@ returns [Instruction result]
);
}
- | INDEXED_MAP_KW
+ | IMP_INDEXED_MAP_KW
value WS+
inr=value_reference WS+
outr=value_reference WS*
@@ -766,7 +782,7 @@ returns [Instruction result]
}
- | MERGE_KW
+ | IMP_MERGE_KW
fun=value WS+
init=value WS+
inr0=value_reference WS+
@@ -790,7 +806,7 @@ returns [Instruction result]
);
}
- | MERGE_KW
+ | IMP_MERGE_KW
fun=value WS+
init=value WS+
def0=value WS+
@@ -818,7 +834,7 @@ returns [Instruction result]
);
}
- | SUB_LIST_KW
+ | IMP_SUB_LIST_KW
vstart=value WS+
vend=value WS+
inr=value_reference WS+
@@ -840,7 +856,7 @@ returns [Instruction result]
);
}
- | FILTER_KW value WS+ value_reference WS* R_PAREN
+ | IMP_FILTER_KW value WS+ value_reference WS* R_PAREN
{
$result =
Filter.build
@@ -855,7 +871,7 @@ returns [Instruction result]
);
}
- | PARTITION_KW
+ | IMP_PARTITION_KW
value WS+
iftrue=value_reference WS+
iffalse=value_reference WS*
@@ -875,7 +891,7 @@ returns [Instruction result]
);
}
- | SORT_KW value WS+ value_reference WS* R_PAREN
+ | IMP_SORT_KW value WS+ value_reference WS* R_PAREN
{
$result =
Sort.build
@@ -890,29 +906,8 @@ returns [Instruction result]
);
}
- | RANGE_KW
- vstart=value WS+
- vend=value WS+
- inc=value WS+
- value_reference WS*
- R_PAREN
- {
- $result =
- Range.build
- (
- CONTEXT.get_origin_at
- (
- ($RANGE_KW.getLine()),
- ($RANGE_KW.getCharPositionInLine())
- ),
- ($vstart.result),
- ($vend.result),
- ($inc.result),
- ($value_reference.result)
- );
- }
- | SHUFFLE_KW value_reference WS* R_PAREN
+ | IMP_SHUFFLE_KW value_reference WS* R_PAREN
{
$result =
Shuffle.build
@@ -955,7 +950,7 @@ returns [Instruction result]
);
}
- | SET_FIELDS_KW value_reference WS* field_value_list WS* R_PAREN
+ | IMP_SET_FIELDS_KW value_reference WS* field_value_list WS* R_PAREN
{
final Origin origin;
final List<Instruction> operations;
@@ -3006,6 +3001,26 @@ returns [Computation result]
);
}
+ | RANGE_KW
+ vstart=value WS+
+ vend=value WS+
+ inc=value WS*
+ R_PAREN
+ {
+ $result =
+ Range.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($RANGE_KW.getLine()),
+ ($RANGE_KW.getCharPositionInLine())
+ ),
+ ($vstart.result),
+ ($vend.result),
+ ($inc.result)
+ );
+ }
+
| COND_KW value_cond_list WS* R_PAREN
{
$result =
@@ -3222,6 +3237,289 @@ returns [Computation result]
);
}
+ | ADD_KW value WS+ value_reference WS* R_PAREN
+ {
+ $result =
+ AddElementComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($ADD_KW.getLine()),
+ ($ADD_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($value_reference.result)
+ );
+ }
+
+ | ADD_AT_KW index=value WS+ element=value WS+ value_reference WS* R_PAREN
+ {
+ $result =
+ AddElementAtComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($ADD_AT_KW.getLine()),
+ ($ADD_AT_KW.getCharPositionInLine())
+ ),
+ ($index.result),
+ ($element.result),
+ ($value_reference.result)
+ );
+ }
+
+ | ADD_ALL_KW
+ source=value_reference WS+
+ target=value_reference WS*
+ R_PAREN
+ {
+ $result =
+ AddElementsOfComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($ADD_ALL_KW.getLine()),
+ ($ADD_ALL_KW.getCharPositionInLine())
+ ),
+ ($source.result),
+ ($target.result)
+ );
+ }
+
+ | REMOVE_ONE_KW
+ value WS+
+ value_reference WS*
+ R_PAREN
+ {
+ $result =
+ RemoveElementComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($REMOVE_ONE_KW.getLine()),
+ ($REMOVE_ONE_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($value_reference.result)
+ );
+ }
+
+ | REMOVE_AT_KW
+ value WS+
+ value_reference WS*
+ R_PAREN
+ {
+ $result =
+ RemoveElementAtComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($REMOVE_AT_KW.getLine()),
+ ($REMOVE_AT_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($value_reference.result)
+ );
+ }
+
+ | REMOVE_ALL_KW
+ value WS+
+ value_reference WS*
+ R_PAREN
+ {
+ $result =
+ RemoveAllOfElementComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($REMOVE_ALL_KW.getLine()),
+ ($REMOVE_ALL_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($value_reference.result)
+ );
+ }
+
+ | REVERSE_KW value_reference WS* R_PAREN
+ {
+ $result =
+ ReverseListComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($REVERSE_KW.getLine()),
+ ($REVERSE_KW.getCharPositionInLine())
+ ),
+ ($value_reference.result)
+ );
+ }
+
+ | MAP_KW
+ value WS+
+ inr=value_reference WS*
+ R_PAREN
+ {
+ $result =
+ tonkadur.fate.v1.lang.computation.MapComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($MAP_KW.getLine()),
+ ($MAP_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($inr.result)
+ );
+ }
+
+ | INDEXED_MAP_KW value WS+ inr=value_reference WS* R_PAREN
+ {
+ $result =
+ IndexedMapComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($INDEXED_MAP_KW.getLine()),
+ ($INDEXED_MAP_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($inr.result)
+ );
+ }
+
+
+ | MERGE_KW
+ fun=value WS+
+ init=value WS+
+ inr0=value_reference WS+
+ inr1=value_reference WS*
+ R_PAREN
+ {
+ $result =
+ MergeComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($MERGE_KW.getLine()),
+ ($MERGE_KW.getCharPositionInLine())
+ ),
+ ($fun.result),
+ ($init.result),
+ ($inr0.result),
+ ($inr1.result)
+ );
+ }
+
+ | MERGE_KW
+ fun=value WS+
+ init=value WS+
+ def0=value WS+
+ inr0=value_reference WS+
+ def1=value WS+
+ inr1=value_reference WS*
+ R_PAREN
+ {
+ $result =
+ MergeComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($MERGE_KW.getLine()),
+ ($MERGE_KW.getCharPositionInLine())
+ ),
+ ($fun.result),
+ ($init.result),
+ ($def0.result),
+ ($inr0.result),
+ ($def1.result),
+ ($inr1.result)
+ );
+ }
+
+ | SUB_LIST_KW
+ vstart=value WS+
+ vend=value WS+
+ inr=value_reference WS+
+ outr=value_reference WS*
+ R_PAREN
+ {
+ $result =
+ SubListComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($SUB_LIST_KW.getLine()),
+ ($SUB_LIST_KW.getCharPositionInLine())
+ ),
+ ($vstart.result),
+ ($vend.result),
+ ($inr.result)
+ );
+ }
+
+ | FILTER_KW value WS+ value_reference WS* R_PAREN
+ {
+ $result =
+ FilterComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($FILTER_KW.getLine()),
+ ($FILTER_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($value_reference.result)
+ );
+ }
+
+ | PARTITION_KW
+ value WS+
+ value_reference WS*
+ R_PAREN
+ {
+ $result =
+ PartitionComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($PARTITION_KW.getLine()),
+ ($PARTITION_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($value_reference.result)
+ );
+ }
+
+ | SORT_KW value WS+ value_reference WS* R_PAREN
+ {
+ $result =
+ SortComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($SORT_KW.getLine()),
+ ($SORT_KW.getCharPositionInLine())
+ ),
+ ($value.result),
+ ($value_reference.result)
+ );
+ }
+
+
+ | SHUFFLE_KW value_reference WS* R_PAREN
+ {
+ $result =
+ ShuffleComputation.build
+ (
+ CONTEXT.get_origin_at
+ (
+ ($SHUFFLE_KW.getLine()),
+ ($SHUFFLE_KW.getCharPositionInLine())
+ ),
+ ($value_reference.result)
+ );
+ }
+
| value_reference
{
$result = ($value_reference.result);