| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src')
63 files changed, 1967 insertions, 353 deletions
| diff --git a/src/core/src/tonkadur/fate/v1/lang/Macro.java b/src/core/src/tonkadur/fate/v1/lang/Macro.java index fd81db1..c4c4dc4 100644 --- a/src/core/src/tonkadur/fate/v1/lang/Macro.java +++ b/src/core/src/tonkadur/fate/v1/lang/Macro.java @@ -6,17 +6,17 @@ import java.util.List;  import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.meta.DeclaredEntity; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.Instruction;  import tonkadur.fate.v1.lang.meta.TypedEntryList; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.instruction.Display;  import tonkadur.fate.v1.lang.instruction.InstructionList; -import tonkadur.fate.v1.lang.valued_node.Cast; -import tonkadur.fate.v1.lang.valued_node.ValueToRichText; +import tonkadur.fate.v1.lang.computation.Cast; +import tonkadur.fate.v1.lang.computation.ValueToRichText;  public class Macro extends DeclaredEntity  { @@ -29,7 +29,7 @@ public class Macro extends DeclaredEntity     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final InstructionNode root; +   protected final Instruction root;     protected final TypedEntryList parameters;     /***************************************************************************/ @@ -40,7 +40,7 @@ public class Macro extends DeclaredEntity     public Macro     (        final Origin origin, -      final InstructionNode root, +      final Instruction root,        final TypedEntryList parameters,        final String name     ) @@ -57,7 +57,7 @@ public class Macro extends DeclaredEntity        return parameters;     } -   public InstructionNode get_root () +   public Instruction get_root ()     {        return root;     } @@ -76,12 +76,12 @@ public class Macro extends DeclaredEntity        return result;     } -   public ValueNode get_value_node_representation () +   public Computation get_value_node_representation ()     {        final Cast result_cast;        InstructionList root_as_il; -      InstructionNode instr; -      ValueNode result; +      Instruction instr; +      Computation result;        if (!(root instanceof InstructionList))        { diff --git a/src/core/src/tonkadur/fate/v1/lang/Sequence.java b/src/core/src/tonkadur/fate/v1/lang/Sequence.java index 8029c61..5b97e5c 100644 --- a/src/core/src/tonkadur/fate/v1/lang/Sequence.java +++ b/src/core/src/tonkadur/fate/v1/lang/Sequence.java @@ -16,7 +16,7 @@ import tonkadur.parser.Origin;  import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.meta.DeclaredEntity; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.Instruction;  public class Sequence extends DeclaredEntity  { @@ -29,7 +29,7 @@ public class Sequence extends DeclaredEntity     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final InstructionNode root; +   protected final Instruction root;     /***************************************************************************/     /**** PUBLIC ***************************************************************/ @@ -39,7 +39,7 @@ public class Sequence extends DeclaredEntity     public Sequence     (        final Origin origin, -      final InstructionNode root, +      final Instruction root,        final String name     )     { @@ -49,7 +49,7 @@ public class Sequence extends DeclaredEntity     }     /**** Accessors ************************************************************/ -   public InstructionNode get_root () +   public Instruction get_root ()     {        return root;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/World.java b/src/core/src/tonkadur/fate/v1/lang/World.java index 3afd60a..d6c8ac0 100644 --- a/src/core/src/tonkadur/fate/v1/lang/World.java +++ b/src/core/src/tonkadur/fate/v1/lang/World.java @@ -18,8 +18,8 @@ import tonkadur.fate.v1.error.UnknownSequenceException;  import tonkadur.fate.v1.lang.meta.DeclarationCollection;  import tonkadur.fate.v1.lang.meta.ExtensionInstruction; -import tonkadur.fate.v1.lang.meta.ExtensionValueNode; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.ExtensionComputation; +import tonkadur.fate.v1.lang.meta.Instruction;  import tonkadur.fate.v1.lang.type.Type; @@ -32,7 +32,7 @@ public class World     protected final Set<String> required_extensions;     protected final Map<String, List<Origin>> sequence_calls; -   protected final Map<String, ExtensionValueNode> extension_value_nodes; +   protected final Map<String, ExtensionComputation> extension_value_nodes;     protected final Map<String, ExtensionInstruction> extension_instructions;     protected final Map<String, ExtensionInstruction>        extension_first_level_instructions; @@ -44,7 +44,7 @@ public class World     protected final DeclarationCollection<Type> type_collection;     protected final DeclarationCollection<Variable> variable_collection; -   protected final List<InstructionNode> global_instructions; +   protected final List<Instruction> global_instructions;     /***************************************************************************/     /**** PUBLIC ***************************************************************/ @@ -57,7 +57,7 @@ public class World        required_extensions = new HashSet<String>();        sequence_calls = new HashMap<String, List<Origin>>(); -      extension_value_nodes = new HashMap<String, ExtensionValueNode>(); +      extension_value_nodes = new HashMap<String, ExtensionComputation>();        extension_instructions = new HashMap<String, ExtensionInstruction>();        extension_first_level_instructions =           new HashMap<String, ExtensionInstruction>(); @@ -76,7 +76,7 @@ public class World        add_base_types(); -      global_instructions = new ArrayList<InstructionNode>(); +      global_instructions = new ArrayList<Instruction>();     }     /**** Accessors ************************************************************/ @@ -142,7 +142,7 @@ public class World        return extension_first_level_instructions;     } -   public Map<String, ExtensionValueNode> extension_value_nodes +   public Map<String, ExtensionComputation> extension_value_nodes     (     )     { @@ -180,12 +180,12 @@ public class World        return variable_collection;     } -   public void add_global_instruction (final InstructionNode instruction) +   public void add_global_instruction (final Instruction instruction)     {        global_instructions.add(instruction);     } -   public List<InstructionNode> get_global_instructions () +   public List<Instruction> get_global_instructions ()     {        return global_instructions;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/AtReference.java b/src/core/src/tonkadur/fate/v1/lang/computation/AtReference.java index 1a8d9a3..176b50c 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/AtReference.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/AtReference.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.Collections; diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/Cast.java b/src/core/src/tonkadur/fate/v1/lang/computation/Cast.java index 41e0ebb..54b5c30 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/Cast.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/Cast.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.Collection;  import java.util.Collections; @@ -16,9 +16,9 @@ import tonkadur.fate.v1.error.IncomparableTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class Cast extends ValueNode +public class Cast extends Computation  {     protected static final Map<Type,Set<Type>> allowed_type_changes; @@ -83,7 +83,7 @@ public class Cast extends ValueNode     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode value; +   protected final Computation value;     protected final boolean is_autogenerated;     /***************************************************************************/ @@ -94,7 +94,7 @@ public class Cast extends ValueNode     (        final Origin origin,        final Type to, -      final ValueNode value, +      final Computation value,        final boolean is_autogenerated     )     { @@ -111,7 +111,7 @@ public class Cast extends ValueNode     (        final Origin origin,        final Type to, -      final ValueNode value, +      final Computation value,        final boolean is_autogenerated     )     throws @@ -172,7 +172,7 @@ public class Cast extends ValueNode        nv.visit_cast(this);     } -   public ValueNode get_parent () +   public Computation get_parent ()     {        return value;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/CondValue.java b/src/core/src/tonkadur/fate/v1/lang/computation/CondValue.java index 60b60c3..e8afd21 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/CondValue.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/CondValue.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.List;  import java.util.Collections; @@ -16,14 +16,14 @@ import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class CondValue extends ValueNode +public class CondValue extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final List<Cons<ValueNode, ValueNode>> branches; +   protected final List<Cons<Computation, Computation>> branches;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -33,7 +33,7 @@ public class CondValue extends ValueNode     (        final Origin origin,        final Type return_type, -      final List<Cons<ValueNode, ValueNode>> branches +      final List<Cons<Computation, Computation>> branches     )     {        super(origin, return_type); @@ -48,7 +48,7 @@ public class CondValue extends ValueNode     public static CondValue build     (        final Origin origin, -      final List<Cons<ValueNode, ValueNode>> branches +      final List<Cons<Computation, Computation>> branches     )     throws        InvalidTypeException, @@ -61,7 +61,7 @@ public class CondValue extends ValueNode        first_type = branches.get(0).get_cdr().get_type();        hint = first_type; -      for (final Cons<ValueNode, ValueNode> entry: branches) +      for (final Cons<Computation, Computation> entry: branches)        {           if (!entry.get_car().get_type().can_be_used_as(Type.BOOLEAN))           { @@ -137,7 +137,7 @@ public class CondValue extends ValueNode        sb.append("(CondValue");        sb.append(System.lineSeparator()); -      for (final Cons<ValueNode, ValueNode> entry: branches) +      for (final Cons<Computation, Computation> entry: branches)        {           sb.append(System.lineSeparator());           sb.append("Condition:"); diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/Constant.java b/src/core/src/tonkadur/fate/v1/lang/computation/Constant.java index abfe38d..56f79f1 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/Constant.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/Constant.java @@ -1,13 +1,13 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class Constant extends ValueNode +public class Constant extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/ diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/CountOperator.java b/src/core/src/tonkadur/fate/v1/lang/computation/CountOperator.java index cbf014c..0c26abc 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/CountOperator.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/CountOperator.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import tonkadur.error.ErrorManager; @@ -12,15 +12,15 @@ import tonkadur.fate.v1.lang.type.CollectionType;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class CountOperator extends ValueNode +public class CountOperator extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode element; -   protected final ValueNode collection; +   protected final Computation element; +   protected final Computation collection;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -29,8 +29,8 @@ public class CountOperator extends ValueNode     protected CountOperator     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     {        super(origin, Type.INT); @@ -46,8 +46,8 @@ public class CountOperator extends ValueNode     public static CountOperator build     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     throws        InvalidTypeException, diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/FieldReference.java b/src/core/src/tonkadur/fate/v1/lang/computation/FieldReference.java index ac855bc..635e372 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/FieldReference.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/FieldReference.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.Collections;  import java.util.List; diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/IfElseValue.java b/src/core/src/tonkadur/fate/v1/lang/computation/IfElseValue.java index 8850966..97fe315 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/IfElseValue.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/IfElseValue.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.Collections; @@ -13,16 +13,16 @@ import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class IfElseValue extends ValueNode +public class IfElseValue extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode condition; -   protected final ValueNode if_true; -   protected final ValueNode if_false; +   protected final Computation condition; +   protected final Computation if_true; +   protected final Computation if_false;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -32,9 +32,9 @@ public class IfElseValue extends ValueNode     (        final Origin origin,        final Type return_type, -      final ValueNode condition, -      final ValueNode if_true, -      final ValueNode if_false +      final Computation condition, +      final Computation if_true, +      final Computation if_false     )     {        super(origin, return_type); @@ -51,9 +51,9 @@ public class IfElseValue extends ValueNode     public static IfElseValue build     (        final Origin origin, -      final ValueNode condition, -      final ValueNode if_true, -      final ValueNode if_false +      final Computation condition, +      final Computation if_true, +      final Computation if_false     )     throws        InvalidTypeException, diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/IsMemberOperator.java b/src/core/src/tonkadur/fate/v1/lang/computation/IsMemberOperator.java index e4411ce..8e4aeb3 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/IsMemberOperator.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/IsMemberOperator.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import tonkadur.error.ErrorManager; @@ -12,15 +12,15 @@ import tonkadur.fate.v1.lang.type.CollectionType;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class IsMemberOperator extends ValueNode +public class IsMemberOperator extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode element; -   protected final ValueNode collection; +   protected final Computation element; +   protected final Computation collection;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -29,8 +29,8 @@ public class IsMemberOperator extends ValueNode     protected IsMemberOperator     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     {        super(origin, Type.BOOLEAN); @@ -46,8 +46,8 @@ public class IsMemberOperator extends ValueNode     public static IsMemberOperator build     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     throws        InvalidTypeException, diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/MacroValueCall.java b/src/core/src/tonkadur/fate/v1/lang/computation/MacroValueCall.java index 32e29ef..83b16d4 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/MacroValueCall.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/MacroValueCall.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.ArrayList;  import java.util.List; @@ -20,16 +20,16 @@ import tonkadur.fate.v1.lang.Macro;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class MacroValueCall extends ValueNode +public class MacroValueCall extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/     protected final Macro macro; -   protected final ValueNode act_as; -   protected final List<ValueNode> parameters; +   protected final Computation act_as; +   protected final List<Computation> parameters;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -39,8 +39,8 @@ public class MacroValueCall extends ValueNode     (        final Origin origin,        final Macro macro, -      final List<ValueNode> parameters, -      final ValueNode act_as +      final List<Computation> parameters, +      final Computation act_as     )     {        super(origin, act_as.get_type()); @@ -58,11 +58,11 @@ public class MacroValueCall extends ValueNode     (        final Origin origin,        final Macro macro, -      final List<ValueNode> parameters +      final List<Computation> parameters     )     throws Throwable     { -      ValueNode act_as; +      Computation act_as;        final List<Type> signature;        act_as = macro.get_value_node_representation(); @@ -91,10 +91,10 @@ public class MacroValueCall extends ValueNode           );        } -      (new Merge<Type, ValueNode, Boolean>() +      (new Merge<Type, Computation, Boolean>()        {           @Override -         public Boolean risky_lambda (final Type t, final ValueNode p) +         public Boolean risky_lambda (final Type t, final Computation p)           throws ParsingError           {              if ((t == null) || (p == null)) @@ -161,12 +161,12 @@ public class MacroValueCall extends ValueNode        return macro;     } -   public ValueNode get_actual_value_node () +   public Computation get_actual_value_node ()     {        return act_as;     } -   public List<ValueNode> get_parameters () +   public List<Computation> get_parameters ()     {        return parameters;     } @@ -180,7 +180,7 @@ public class MacroValueCall extends ValueNode        sb.append("(MacroValueCall (");        sb.append(macro.get_name()); -      for (final ValueNode param: parameters) +      for (final Computation param: parameters)        {           sb.append(" ");           sb.append(param.toString()); diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/Newline.java b/src/core/src/tonkadur/fate/v1/lang/computation/Newline.java index 5698dc3..13b9671 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/Newline.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/Newline.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import tonkadur.parser.Origin; diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/Operation.java b/src/core/src/tonkadur/fate/v1/lang/computation/Operation.java index 00331df..44f2a45 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/Operation.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/Operation.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.Collection;  import java.util.List; @@ -16,19 +16,19 @@ import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class Operation extends ValueNode +public class Operation extends Computation  {     protected final Operator operator; -   protected final List<ValueNode> operands; +   protected final List<Computation> operands;     protected Operation     (        final Origin origin,        final Type result_type,        final Operator operator, -      final List<ValueNode> operands +      final List<Computation> operands     )     {        super(origin, result_type); @@ -41,7 +41,7 @@ public class Operation extends ValueNode     (        final Origin origin,        final Operator operator, -      final List<ValueNode> operands +      final List<Computation> operands     )     throws        //ConflictingTypeException, @@ -85,7 +85,7 @@ public class Operation extends ValueNode        computed_type = operands.get(0).get_type(); -      for (final ValueNode operand: operands) +      for (final Computation operand: operands)        {           final Type operand_type; diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/Operator.java b/src/core/src/tonkadur/fate/v1/lang/computation/Operator.java index 7f1db14..5cda7c2 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/Operator.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/Operator.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.Collections;  import java.util.Set; @@ -70,21 +70,15 @@ public class Operator           );        EQUALS = -         new Operator -         ( -            "equals", -            2, -            0, -            Type.SIMPLE_BASE_TYPES, -            Type.BOOLEAN -         ); - -      LOWER_THAN = new Operator("<", 2, 2, Type.NUMBER_TYPES, Type.BOOLEAN); +         new Operator("equals", 2, 0, Type.SIMPLE_BASE_TYPES, Type.BOOLEAN); +      LOWER_THAN = +         new Operator("<", 2, 2, Type.SIMPLE_BASE_TYPES, Type.BOOLEAN);        LOWER_EQUAL_THAN = -         new Operator("=<", 2, 2, Type.NUMBER_TYPES, Type.BOOLEAN); +         new Operator("=<", 2, 2, Type.SIMPLE_BASE_TYPES, Type.BOOLEAN);        GREATER_EQUAL_THAN = -         new Operator(">=", 2, 2, Type.NUMBER_TYPES, Type.BOOLEAN); -      GREATER_THAN = new Operator(">", 2, 2, Type.NUMBER_TYPES, Type.BOOLEAN); +         new Operator(">=", 2, 2, Type.SIMPLE_BASE_TYPES, Type.BOOLEAN); +      GREATER_THAN = +         new Operator(">", 2, 2, Type.SIMPLE_BASE_TYPES, Type.BOOLEAN);     }     final protected String name; diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/Paragraph.java b/src/core/src/tonkadur/fate/v1/lang/computation/Paragraph.java index 5b022f9..0d1b8ce 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/Paragraph.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/Paragraph.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.List; diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/ParameterReference.java b/src/core/src/tonkadur/fate/v1/lang/computation/ParameterReference.java index 6f6b2cf..06cf523 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/ParameterReference.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/ParameterReference.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import tonkadur.parser.Origin; diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/RefOperator.java b/src/core/src/tonkadur/fate/v1/lang/computation/RefOperator.java index 27f9474..edbcc29 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/RefOperator.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/RefOperator.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import tonkadur.parser.Origin; @@ -6,9 +6,9 @@ import tonkadur.fate.v1.lang.type.RefType;  import tonkadur.fate.v1.lang.meta.NodeVisitor;  import tonkadur.fate.v1.lang.meta.Reference; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class RefOperator extends ValueNode +public class RefOperator extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/ diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/TextWithEffect.java b/src/core/src/tonkadur/fate/v1/lang/computation/TextWithEffect.java index 457258a..7be47c1 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/TextWithEffect.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/TextWithEffect.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import java.util.ArrayList;  import java.util.List; @@ -20,7 +20,7 @@ import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor;  import tonkadur.fate.v1.lang.meta.RichTextNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation;  public class TextWithEffect extends RichTextNode  { @@ -28,7 +28,7 @@ public class TextWithEffect extends RichTextNode     /**** MEMBERS **************************************************************/     /***************************************************************************/     protected final TextEffect effect; -   protected final List<ValueNode> parameters; +   protected final List<Computation> parameters;     protected final RichTextNode text;     /***************************************************************************/ @@ -39,7 +39,7 @@ public class TextWithEffect extends RichTextNode     (        final Origin origin,        final TextEffect effect, -      final List<ValueNode> parameters, +      final List<Computation> parameters,        final RichTextNode text     )     { @@ -58,7 +58,7 @@ public class TextWithEffect extends RichTextNode     (        final Origin origin,        final TextEffect effect, -      final List<ValueNode> parameters, +      final List<Computation> parameters,        final RichTextNode text     )     throws Throwable @@ -81,10 +81,10 @@ public class TextWithEffect extends RichTextNode           );        } -      (new Merge<Type,ValueNode,Boolean>() +      (new Merge<Type,Computation,Boolean>()        {           @Override -         public Boolean risky_lambda (final Type t, final ValueNode p) +         public Boolean risky_lambda (final Type t, final Computation p)           throws ParsingError           {              if ((t == null) || (p == null)) @@ -151,7 +151,7 @@ public class TextWithEffect extends RichTextNode        return effect;     } -   public List<ValueNode> get_parameters () +   public List<Computation> get_parameters ()     {        return parameters;     } @@ -170,7 +170,7 @@ public class TextWithEffect extends RichTextNode        sb.append("(TextWithEffect (");        sb.append(effect.get_name()); -      for (final ValueNode param: parameters) +      for (final Computation param: parameters)        {           sb.append(" ");           sb.append(param.toString()); diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/ValueToRichText.java b/src/core/src/tonkadur/fate/v1/lang/computation/ValueToRichText.java index 1a84986..917f4ad 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/ValueToRichText.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/ValueToRichText.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import tonkadur.parser.Origin; @@ -9,20 +9,20 @@ import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor;  import tonkadur.fate.v1.lang.meta.RichTextNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation;  public class ValueToRichText extends RichTextNode  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode value; +   protected final Computation value;     /***************************************************************************/     /**** PROTECTED ************************************************************/     /***************************************************************************/     /**** Constructors *********************************************************/ -   protected ValueToRichText (final ValueNode value) +   protected ValueToRichText (final Computation value)     {        super(value.get_origin()); @@ -33,7 +33,7 @@ public class ValueToRichText extends RichTextNode     /**** PUBLIC ***************************************************************/     /***************************************************************************/     /**** Constructors *********************************************************/ -   public static ValueToRichText build (final ValueNode value) +   public static ValueToRichText build (final Computation value)     throws        IncompatibleTypeException,        IncomparableTypeException @@ -68,7 +68,7 @@ public class ValueToRichText extends RichTextNode        nv.visit_value_to_rich_text(this);     } -   public ValueNode get_value () +   public Computation get_value ()     {        return value;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/valued_node/VariableReference.java b/src/core/src/tonkadur/fate/v1/lang/computation/VariableReference.java index 877bcf1..d8522c2 100644 --- a/src/core/src/tonkadur/fate/v1/lang/valued_node/VariableReference.java +++ b/src/core/src/tonkadur/fate/v1/lang/computation/VariableReference.java @@ -1,4 +1,4 @@ -package tonkadur.fate.v1.lang.valued_node; +package tonkadur.fate.v1.lang.computation;  import tonkadur.parser.Origin; diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/AddElement.java b/src/core/src/tonkadur/fate/v1/lang/instruction/AddElement.java index 455d241..759a882 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/AddElement.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/AddElement.java @@ -12,16 +12,16 @@ import tonkadur.fate.v1.lang.type.CollectionType;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class AddElement extends InstructionNode +public class AddElement extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode element; -   protected final ValueNode collection; +   protected final Computation element; +   protected final Computation collection;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -30,8 +30,8 @@ public class AddElement extends InstructionNode     protected AddElement     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     {        super(origin); @@ -47,8 +47,8 @@ public class AddElement extends InstructionNode     public static AddElement build     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     throws        InvalidTypeException, @@ -132,6 +132,16 @@ public class AddElement extends InstructionNode        nv.visit_add_element(this);     } +   public Computation get_collection () +   { +      return collection; +   } + +   public Computation get_element () +   { +      return element +   } +     /**** Misc. ****************************************************************/     @Override     public String toString () diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/Assert.java b/src/core/src/tonkadur/fate/v1/lang/instruction/Assert.java index 8cb3fae..8e7dbc5 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/Assert.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/Assert.java @@ -11,15 +11,15 @@ import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class Assert extends InstructionNode +public class Assert extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode condition; +   protected final Computation condition;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -28,7 +28,7 @@ public class Assert extends InstructionNode     protected Assert     (        final Origin origin, -      final ValueNode condition +      final Computation condition     )     {        super(origin); @@ -43,7 +43,7 @@ public class Assert extends InstructionNode     public static Assert build     (        final Origin origin, -      final ValueNode condition +      final Computation condition     )     throws InvalidTypeException     { @@ -71,7 +71,7 @@ public class Assert extends InstructionNode        nv.visit_assert(this);     } -   public ValueNode get_condition () +   public Computation get_condition ()     {        return condition;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/Clear.java b/src/core/src/tonkadur/fate/v1/lang/instruction/Clear.java index af39742..e414e19 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/Clear.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/Clear.java @@ -10,15 +10,15 @@ import tonkadur.fate.v1.lang.type.CollectionType;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class Clear extends InstructionNode +public class Clear extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode collection; +   protected final Computation collection;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -27,7 +27,7 @@ public class Clear extends InstructionNode     protected Clear     (        final Origin origin, -      final ValueNode collection +      final Computation collection     )     {        super(origin); @@ -42,7 +42,7 @@ public class Clear extends InstructionNode     public static Clear build     (        final Origin origin, -      final ValueNode collection +      final Computation collection     )     throws InvalidTypeException     { @@ -73,7 +73,7 @@ public class Clear extends InstructionNode        nv.visit_clear(this);     } -   public ValueNode get_collection () +   public Computation get_collection ()     {        return collection;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/CondInstruction.java b/src/core/src/tonkadur/fate/v1/lang/instruction/CondInstruction.java index 6caa16f..1fd1bce 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/CondInstruction.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/CondInstruction.java @@ -14,15 +14,15 @@ import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class CondInstruction extends InstructionNode +public class CondInstruction extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final List<Cons<ValueNode, InstructionNode>> branches; +   protected final List<Cons<Computation, Instruction>> branches;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -31,7 +31,7 @@ public class CondInstruction extends InstructionNode     protected CondInstruction     (        final Origin origin, -      final List<Cons<ValueNode, InstructionNode>> branches +      final List<Cons<Computation, Instruction>> branches     )     {        super(origin); @@ -46,11 +46,11 @@ public class CondInstruction extends InstructionNode     public static CondInstruction build     (        final Origin origin, -      final List<Cons<ValueNode, InstructionNode>> branches +      final List<Cons<Computation, Instruction>> branches     )     throws InvalidTypeException     { -      for (final Cons<ValueNode, InstructionNode> branch: branches) +      for (final Cons<Computation, Instruction> branch: branches)        {           if (!branch.get_car().get_type().get_base_type().equals(Type.BOOLEAN))           { @@ -77,7 +77,7 @@ public class CondInstruction extends InstructionNode        nv.visit_cond_instruction(this);     } -   public List<Cons<ValueNode, InstructionNode>> get_branches () +   public List<Cons<Computation, Instruction>> get_branches ()     {        return branches;     } @@ -91,7 +91,7 @@ public class CondInstruction extends InstructionNode        sb.append("(CondInstruction");        sb.append(System.lineSeparator()); -      for (final Cons<ValueNode, InstructionNode> branch: branches) +      for (final Cons<Computation, Instruction> branch: branches)        {           sb.append(System.lineSeparator());           sb.append("if:"); diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/Display.java b/src/core/src/tonkadur/fate/v1/lang/instruction/Display.java index e383a0d..24fc27d 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/Display.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/Display.java @@ -9,10 +9,10 @@ import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.Instruction;  import tonkadur.fate.v1.lang.meta.RichTextNode; -public class Display extends InstructionNode +public class Display extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/ diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/EventCall.java b/src/core/src/tonkadur/fate/v1/lang/instruction/EventCall.java index 3e57471..e9bf5f9 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/EventCall.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/EventCall.java @@ -19,16 +19,16 @@ import tonkadur.fate.v1.lang.Event;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class EventCall extends InstructionNode +public class EventCall extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/     protected final Event event; -   protected final List<ValueNode> parameters; +   protected final List<Computation> parameters;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -38,7 +38,7 @@ public class EventCall extends InstructionNode     (        final Origin origin,        final Event event, -      final List<ValueNode> parameters +      final List<Computation> parameters     )     {        super(origin); @@ -55,7 +55,7 @@ public class EventCall extends InstructionNode     (        final Origin origin,        final Event event, -      final List<ValueNode> parameters +      final List<Computation> parameters     )     throws Throwable     { @@ -78,10 +78,10 @@ public class EventCall extends InstructionNode           );        } -      (new Merge<Type, ValueNode, Boolean>() +      (new Merge<Type, Computation, Boolean>()        {           @Override -         public Boolean risky_lambda (final Type t, final ValueNode p) +         public Boolean risky_lambda (final Type t, final Computation p)           throws ParsingError           {              if ((t == null) || (p == null)) @@ -148,7 +148,7 @@ public class EventCall extends InstructionNode        return event;     } -   public List<ValueNode> get_parameters () +   public List<Computation> get_parameters ()     {        return parameters;     } @@ -162,7 +162,7 @@ public class EventCall extends InstructionNode        sb.append("(EventCall (");        sb.append(event.get_name()); -      for (final ValueNode param: parameters) +      for (final Computation param: parameters)        {           sb.append(" ");           sb.append(param.toString()); diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/IfElseInstruction.java b/src/core/src/tonkadur/fate/v1/lang/instruction/IfElseInstruction.java index cb4596e..c07a8d6 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/IfElseInstruction.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/IfElseInstruction.java @@ -11,17 +11,17 @@ import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class IfElseInstruction extends InstructionNode +public class IfElseInstruction extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode condition; -   protected final InstructionNode if_true; -   protected final InstructionNode if_false; +   protected final Computation condition; +   protected final Instruction if_true; +   protected final Instruction if_false;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -30,9 +30,9 @@ public class IfElseInstruction extends InstructionNode     protected IfElseInstruction     (        final Origin origin, -      final ValueNode condition, -      final InstructionNode if_true, -      final InstructionNode if_false +      final Computation condition, +      final Instruction if_true, +      final Instruction if_false     )     {        super(origin); @@ -49,9 +49,9 @@ public class IfElseInstruction extends InstructionNode     public static IfElseInstruction build     (        final Origin origin, -      final ValueNode condition, -      final InstructionNode if_true, -      final InstructionNode if_false +      final Computation condition, +      final Instruction if_true, +      final Instruction if_false     )     throws InvalidTypeException     { @@ -79,17 +79,17 @@ public class IfElseInstruction extends InstructionNode        nv.visit_if_else_instruction(this);     } -   public ValueNode get_condition () +   public Computation get_condition ()     {        return condition;     } -   public InstructionNode get_if_true () +   public Instruction get_if_true ()     {        return if_true;     } -   public InstructionNode get_if_false () +   public Instruction get_if_false ()     {        return if_false;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/IfInstruction.java b/src/core/src/tonkadur/fate/v1/lang/instruction/IfInstruction.java index b1b37b3..7dfe376 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/IfInstruction.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/IfInstruction.java @@ -11,16 +11,16 @@ import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class IfInstruction extends InstructionNode +public class IfInstruction extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode condition; -   protected final InstructionNode if_true; +   protected final Computation condition; +   protected final Instruction if_true;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -29,8 +29,8 @@ public class IfInstruction extends InstructionNode     protected IfInstruction     (        final Origin origin, -      final ValueNode condition, -      final InstructionNode if_true +      final Computation condition, +      final Instruction if_true     )     {        super(origin); @@ -46,8 +46,8 @@ public class IfInstruction extends InstructionNode     public static IfInstruction build     (        final Origin origin, -      final ValueNode condition, -      final InstructionNode if_true +      final Computation condition, +      final Instruction if_true     )     throws InvalidTypeException     { @@ -75,12 +75,12 @@ public class IfInstruction extends InstructionNode        nv.visit_if_instruction(this);     } -   public ValueNode get_condition () +   public Computation get_condition ()     {        return condition;     } -   public InstructionNode get_if_true () +   public Instruction get_if_true ()     {        return if_true;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/InstructionList.java b/src/core/src/tonkadur/fate/v1/lang/instruction/InstructionList.java index df77bbe..658fa58 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/InstructionList.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/InstructionList.java @@ -5,14 +5,14 @@ import java.util.List;  import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.Instruction; -public class InstructionList extends InstructionNode +public class InstructionList extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final List<InstructionNode> instructions; +   protected final List<Instruction> instructions;     /***************************************************************************/     /**** PUBLIC ***************************************************************/ @@ -21,7 +21,7 @@ public class InstructionList extends InstructionNode     public InstructionList     (        final Origin origin, -      final List<InstructionNode> instructions +      final List<Instruction> instructions     )     {        super(origin); @@ -37,7 +37,7 @@ public class InstructionList extends InstructionNode        nv.visit_instruction_list(this);     } -   public List<InstructionNode> get_instructions () +   public List<Instruction> get_instructions ()     {        return instructions;     } @@ -52,7 +52,7 @@ public class InstructionList extends InstructionNode        sb.append(System.lineSeparator()); -      for (final InstructionNode instruction: instructions) +      for (final Instruction instruction: instructions)        {           sb.append(instruction.toString());           sb.append(System.lineSeparator()); diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/MacroCall.java b/src/core/src/tonkadur/fate/v1/lang/instruction/MacroCall.java index 95a1d51..3588f65 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/MacroCall.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/MacroCall.java @@ -19,16 +19,16 @@ import tonkadur.fate.v1.lang.Macro;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class MacroCall extends InstructionNode +public class MacroCall extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/     protected final Macro macro; -   protected final List<ValueNode> parameters; +   protected final List<Computation> parameters;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -38,7 +38,7 @@ public class MacroCall extends InstructionNode     (        final Origin origin,        final Macro macro, -      final List<ValueNode> parameters +      final List<Computation> parameters     )     {        super(origin); @@ -55,7 +55,7 @@ public class MacroCall extends InstructionNode     (        final Origin origin,        final Macro macro, -      final List<ValueNode> parameters +      final List<Computation> parameters     )     throws Throwable     { @@ -78,10 +78,10 @@ public class MacroCall extends InstructionNode           );        } -      (new Merge<Type, ValueNode, Boolean>() +      (new Merge<Type, Computation, Boolean>()        {           @Override -         public Boolean risky_lambda (final Type t, final ValueNode p) +         public Boolean risky_lambda (final Type t, final Computation p)           throws ParsingError           {              if ((t == null) || (p == null)) @@ -148,7 +148,7 @@ public class MacroCall extends InstructionNode        return macro;     } -   public List<ValueNode> get_parameters () +   public List<Computation> get_parameters ()     {        return parameters;     } @@ -162,7 +162,7 @@ public class MacroCall extends InstructionNode        sb.append("(MacroCall (");        sb.append(macro.get_name()); -      for (final ValueNode param: parameters) +      for (final Computation param: parameters)        {           sb.append(" ");           sb.append(param.toString()); diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/PlayerChoice.java b/src/core/src/tonkadur/fate/v1/lang/instruction/PlayerChoice.java index e57fe2a..fdebb80 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/PlayerChoice.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/PlayerChoice.java @@ -7,16 +7,16 @@ import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.Instruction;  import tonkadur.fate.v1.lang.meta.RichTextNode; -public class PlayerChoice extends InstructionNode +public class PlayerChoice extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/     protected final RichTextNode text; -   protected final List<InstructionNode> effects; +   protected final List<Instruction> effects;     /***************************************************************************/     /**** PUBLIC ***************************************************************/ @@ -26,7 +26,7 @@ public class PlayerChoice extends InstructionNode     (        final Origin origin,        final RichTextNode text, -      final List<InstructionNode> effects +      final List<Instruction> effects     )     {        super(origin); @@ -49,7 +49,7 @@ public class PlayerChoice extends InstructionNode        return text;     } -   public List<InstructionNode> get_effects () +   public List<Instruction> get_effects ()     {        return effects;     } @@ -64,7 +64,7 @@ public class PlayerChoice extends InstructionNode        sb.append(System.lineSeparator());        sb.append(text.toString()); -      for (final InstructionNode effect: effects) +      for (final Instruction effect: effects)        {           sb.append(System.lineSeparator());           sb.append(effect.toString()); diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/PlayerChoiceList.java b/src/core/src/tonkadur/fate/v1/lang/instruction/PlayerChoiceList.java index 3efb72f..f9841fd 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/PlayerChoiceList.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/PlayerChoiceList.java @@ -5,14 +5,14 @@ import java.util.List;  import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.Instruction; -public class PlayerChoiceList extends InstructionNode +public class PlayerChoiceList extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final List<InstructionNode> choices; +   protected final List<Instruction> choices;     /***************************************************************************/     /**** PUBLIC ***************************************************************/ @@ -21,7 +21,7 @@ public class PlayerChoiceList extends InstructionNode     public PlayerChoiceList     (        final Origin origin, -      final List<InstructionNode> choices +      final List<Instruction> choices     )     {        super(origin); @@ -37,7 +37,7 @@ public class PlayerChoiceList extends InstructionNode        nv.visit_player_choice_list(this);     } -   public List<InstructionNode> get_choices () +   public List<Instruction> get_choices ()     {        return choices;     } @@ -52,7 +52,7 @@ public class PlayerChoiceList extends InstructionNode        sb.append(System.lineSeparator()); -      for (final InstructionNode choice: choices) +      for (final Instruction choice: choices)        {           sb.append(choice.toString());           sb.append(System.lineSeparator()); diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/RemoveAllOfElement.java b/src/core/src/tonkadur/fate/v1/lang/instruction/RemoveAllOfElement.java index 5e51e8c..f8568a0 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/RemoveAllOfElement.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/RemoveAllOfElement.java @@ -12,16 +12,16 @@ import tonkadur.fate.v1.lang.type.CollectionType;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class RemoveAllOfElement extends InstructionNode +public class RemoveAllOfElement extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode element; -   protected final ValueNode collection; +   protected final Computation element; +   protected final Computation collection;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -30,8 +30,8 @@ public class RemoveAllOfElement extends InstructionNode     protected RemoveAllOfElement     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     {        super(origin); @@ -47,8 +47,8 @@ public class RemoveAllOfElement extends InstructionNode     public static RemoveAllOfElement build     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     throws        InvalidTypeException, diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/RemoveElement.java b/src/core/src/tonkadur/fate/v1/lang/instruction/RemoveElement.java index 3ae0122..bc93e6a 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/RemoveElement.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/RemoveElement.java @@ -12,16 +12,16 @@ import tonkadur.fate.v1.lang.type.CollectionType;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class RemoveElement extends InstructionNode +public class RemoveElement extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode element; -   protected final ValueNode collection; +   protected final Computation element; +   protected final Computation collection;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -30,8 +30,8 @@ public class RemoveElement extends InstructionNode     protected RemoveElement     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     {        super(origin); @@ -47,8 +47,8 @@ public class RemoveElement extends InstructionNode     public static RemoveElement build     (        final Origin origin, -      final ValueNode element, -      final ValueNode collection +      final Computation element, +      final Computation collection     )     throws        InvalidTypeException, diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/SequenceCall.java b/src/core/src/tonkadur/fate/v1/lang/instruction/SequenceCall.java index a1be965..fefe8d8 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/SequenceCall.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/SequenceCall.java @@ -3,9 +3,9 @@ package tonkadur.fate.v1.lang.instruction;  import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.Instruction; -public class SequenceCall extends InstructionNode +public class SequenceCall extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/ diff --git a/src/core/src/tonkadur/fate/v1/lang/instruction/SetValue.java b/src/core/src/tonkadur/fate/v1/lang/instruction/SetValue.java index f0aa20c..1d840e6 100644 --- a/src/core/src/tonkadur/fate/v1/lang/instruction/SetValue.java +++ b/src/core/src/tonkadur/fate/v1/lang/instruction/SetValue.java @@ -11,16 +11,16 @@ import tonkadur.fate.v1.error.InvalidTypeException;  import tonkadur.fate.v1.lang.type.Type;  import tonkadur.fate.v1.lang.meta.NodeVisitor; -import tonkadur.fate.v1.lang.meta.InstructionNode; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Instruction; +import tonkadur.fate.v1.lang.meta.Computation; -public class SetValue extends InstructionNode +public class SetValue extends Instruction  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final ValueNode element; -   protected final ValueNode value_reference; +   protected final Computation element; +   protected final Computation value_reference;     /***************************************************************************/     /**** PROTECTED ************************************************************/ @@ -29,8 +29,8 @@ public class SetValue extends InstructionNode     protected SetValue     (        final Origin origin, -      final ValueNode element, -      final ValueNode value_reference +      final Computation element, +      final Computation value_reference     )     {        super(origin); @@ -46,8 +46,8 @@ public class SetValue extends InstructionNode     public static SetValue build     (        final Origin origin, -      final ValueNode element, -      final ValueNode value_reference +      final Computation element, +      final Computation value_reference     )     throws        InvalidTypeException, diff --git a/src/core/src/tonkadur/fate/v1/lang/meta/ValueNode.java b/src/core/src/tonkadur/fate/v1/lang/meta/Computation.java index f1a8b64..f7dbcd3 100644 --- a/src/core/src/tonkadur/fate/v1/lang/meta/ValueNode.java +++ b/src/core/src/tonkadur/fate/v1/lang/meta/Computation.java @@ -4,7 +4,7 @@ import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.type.Type; -public abstract class ValueNode extends Node +public abstract class Computation extends Node  {     /***************************************************************************/     /**** MEMBERS **************************************************************/ @@ -15,7 +15,7 @@ public abstract class ValueNode extends Node     /**** PROTECTED ************************************************************/     /***************************************************************************/     /**** Constructors *********************************************************/ -   protected ValueNode (final Origin origin, final Type type) +   protected Computation (final Origin origin, final Type type)     {        super(origin); diff --git a/src/core/src/tonkadur/fate/v1/lang/meta/ExtensionValueNode.java b/src/core/src/tonkadur/fate/v1/lang/meta/ExtensionComputation.java index 57addaf..465aed7 100644 --- a/src/core/src/tonkadur/fate/v1/lang/meta/ExtensionValueNode.java +++ b/src/core/src/tonkadur/fate/v1/lang/meta/ExtensionComputation.java @@ -9,15 +9,15 @@ import tonkadur.fate.v1.lang.World;  import tonkadur.fate.v1.lang.type.Type; -import tonkadur.fate.v1.lang.meta.ValueNode; +import tonkadur.fate.v1.lang.meta.Computation; -public class ExtensionValueNode extends ValueNode +public class ExtensionComputation extends Computation  {     /***************************************************************************/     /**** PUBLIC ***************************************************************/     /***************************************************************************/     /**** Constructors *********************************************************/ -   protected ExtensionValueNode +   protected ExtensionComputation     (        final Origin origin,        final Type result_type @@ -26,14 +26,14 @@ public class ExtensionValueNode extends ValueNode        super(origin, result_type);     } -   public ExtensionValueNode build +   public ExtensionComputation build     (        final World world,        final Context context,        final Origin origin, -      final List<ValueNode> parameters +      final List<Computation> parameters     )     { -      return new ExtensionValueNode(Origin.BASE_LANGUAGE, Type.ANY); +      return new ExtensionComputation(Origin.BASE_LANGUAGE, Type.ANY);     }  } diff --git a/src/core/src/tonkadur/fate/v1/lang/meta/ExtensionInstruction.java b/src/core/src/tonkadur/fate/v1/lang/meta/ExtensionInstruction.java index 349731f..939e151 100644 --- a/src/core/src/tonkadur/fate/v1/lang/meta/ExtensionInstruction.java +++ b/src/core/src/tonkadur/fate/v1/lang/meta/ExtensionInstruction.java @@ -9,9 +9,9 @@ import tonkadur.fate.v1.lang.World;  import tonkadur.fate.v1.lang.type.Type; -import tonkadur.fate.v1.lang.meta.InstructionNode; +import tonkadur.fate.v1.lang.meta.Instruction; -public class ExtensionInstruction extends InstructionNode +public class ExtensionInstruction extends Instruction  {     /***************************************************************************/     /**** PUBLIC ***************************************************************/ @@ -27,7 +27,7 @@ public class ExtensionInstruction extends InstructionNode        final World world,        final Context context,        final Origin origin, -      final List<InstructionNode> parameters +      final List<Instruction> parameters     )     {        return new ExtensionInstruction(Origin.BASE_LANGUAGE); diff --git a/src/core/src/tonkadur/fate/v1/lang/meta/InstructionNode.java b/src/core/src/tonkadur/fate/v1/lang/meta/Instruction.java index 3587152..f77206a 100644 --- a/src/core/src/tonkadur/fate/v1/lang/meta/InstructionNode.java +++ b/src/core/src/tonkadur/fate/v1/lang/meta/Instruction.java @@ -5,23 +5,23 @@ import java.util.HashSet;  import tonkadur.parser.Origin; -public abstract class InstructionNode extends Node +public abstract class Instruction extends Node  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final Collection<InstructionNode> parents; -   protected InstructionNode child; +   protected final Collection<Instruction> parents; +   protected Instruction child;     /***************************************************************************/     /**** PROTECTED ************************************************************/     /***************************************************************************/     /**** Constructors *********************************************************/ -   protected InstructionNode (final Origin origin) +   protected Instruction (final Origin origin)     {        super(origin); -      parents = new HashSet<InstructionNode>(); +      parents = new HashSet<Instruction>();        child = null;     } @@ -29,19 +29,19 @@ public abstract class InstructionNode extends Node     /**** PUBLIC ***************************************************************/     /***************************************************************************/     /**** Accessors ************************************************************/ -   public void link_parent (final InstructionNode parent) +   public void link_parent (final Instruction parent)     {        parent.child = this;        parents.add(parent);     } -   public Collection<InstructionNode> get_parents () +   public Collection<Instruction> get_parents ()     {        return parents;     } -   public InstructionNode get_child () +   public Instruction get_child ()     {        return child;     } diff --git a/src/core/src/tonkadur/fate/v1/lang/meta/NodeVisitor.java b/src/core/src/tonkadur/fate/v1/lang/meta/NodeVisitor.java index 3b9527c..f294da5 100644 --- a/src/core/src/tonkadur/fate/v1/lang/meta/NodeVisitor.java +++ b/src/core/src/tonkadur/fate/v1/lang/meta/NodeVisitor.java @@ -3,7 +3,7 @@ package tonkadur.fate.v1.lang.meta;  import tonkadur.fate.v1.lang.World;  import tonkadur.fate.v1.lang.instruction.*; -import tonkadur.fate.v1.lang.valued_node.*; +import tonkadur.fate.v1.lang.computation.*;  public interface NodeVisitor  { diff --git a/src/core/src/tonkadur/fate/v1/lang/meta/Reference.java b/src/core/src/tonkadur/fate/v1/lang/meta/Reference.java index 285dac7..52f9057 100644 --- a/src/core/src/tonkadur/fate/v1/lang/meta/Reference.java +++ b/src/core/src/tonkadur/fate/v1/lang/meta/Reference.java @@ -4,7 +4,7 @@ import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.type.Type; -public abstract class Reference extends ValueNode +public abstract class Reference extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/ diff --git a/src/core/src/tonkadur/fate/v1/lang/meta/RichTextNode.java b/src/core/src/tonkadur/fate/v1/lang/meta/RichTextNode.java index 7a4a44d..1afd6fe 100644 --- a/src/core/src/tonkadur/fate/v1/lang/meta/RichTextNode.java +++ b/src/core/src/tonkadur/fate/v1/lang/meta/RichTextNode.java @@ -5,7 +5,7 @@ import tonkadur.parser.Origin;  import tonkadur.fate.v1.lang.type.Type; -public abstract class RichTextNode extends ValueNode +public abstract class RichTextNode extends Computation  {     /***************************************************************************/     /**** PROTECTED ************************************************************/ diff --git a/src/core/src/tonkadur/fate/v1/parser/FateParser.g4 b/src/core/src/tonkadur/fate/v1/parser/FateParser.g4 index f9d9638..b77ad98 100644 --- a/src/core/src/tonkadur/fate/v1/parser/FateParser.g4 +++ b/src/core/src/tonkadur/fate/v1/parser/FateParser.g4 @@ -35,7 +35,7 @@ options     import tonkadur.fate.v1.lang.instruction.*;     import tonkadur.fate.v1.lang.meta.*;     import tonkadur.fate.v1.lang.type.*; -   import tonkadur.fate.v1.lang.valued_node.*; +   import tonkadur.fate.v1.lang.computation.*;  }  @members @@ -76,10 +76,10 @@ fate_file [Context context, World world]  ;  general_fate_sequence -returns [List<InstructionNode> result] +returns [List<Instruction> result]  @init  { -   $result = new ArrayList<InstructionNode>(); +   $result = new ArrayList<Instruction>();  }  :     (WS* @@ -556,7 +556,7 @@ catch [final Throwable e]  /* Trying to get rule priorities right */  general_fate_instr -returns [InstructionNode result] +returns [Instruction result]  :     L_PAREN WS+ general_fate_sequence WS* R_PAREN     { @@ -649,7 +649,7 @@ returns [InstructionNode result]     | SET_FIELDS_KW value_reference WS* field_value_list WS* R_PAREN     {        final Origin origin; -      final List<InstructionNode> operations; +      final List<Instruction> operations;        origin =           CONTEXT.get_origin_at @@ -658,11 +658,11 @@ returns [InstructionNode result]              ($SET_FIELDS_KW.getCharPositionInLine())           ); -      operations = new ArrayList<InstructionNode>(); +      operations = new ArrayList<Instruction>();        for        ( -         final Cons<Origin, Cons<String, ValueNode>> entry: +         final Cons<Origin, Cons<String, Computation>> entry:              ($field_value_list.result)        )        { @@ -727,7 +727,7 @@ returns [InstructionNode result]           (              origin,              event, -            new ArrayList<ValueNode>() +            new ArrayList<Computation>()           );     } @@ -907,10 +907,10 @@ catch [final Throwable e]  }  instr_cond_list -returns [List<Cons<ValueNode, InstructionNode>> result] +returns [List<Cons<Computation, Instruction>> result]  @init  { -   $result = new ArrayList<Cons<ValueNode, InstructionNode>>(); +   $result = new ArrayList<Cons<Computation, Instruction>>();  }  :     ( @@ -925,10 +925,10 @@ returns [List<Cons<ValueNode, InstructionNode>> result]  ;  player_choice_list -returns [List<InstructionNode> result] +returns [List<Instruction> result]  @init  { -   $result = new ArrayList<InstructionNode>(); +   $result = new ArrayList<Instruction>();  }  :     (WS* @@ -942,7 +942,7 @@ returns [List<InstructionNode> result]  ;  player_choice -returns [InstructionNode result] +returns [Instruction result]  :     start_p=L_PAREN WS*        L_PAREN WS* paragraph WS* R_PAREN WS+ @@ -1024,10 +1024,10 @@ catch [final Throwable e]  }  player_choice_cond_list -returns [List<Cons<ValueNode, InstructionNode>> result] +returns [List<Cons<Computation, Instruction>> result]  @init  { -   $result = new ArrayList<Cons<ValueNode, InstructionNode>>(); +   $result = new ArrayList<Cons<Computation, Instruction>>();  }  :     ( @@ -1148,7 +1148,7 @@ returns [RichTextNode result]:                 ($WORD.getCharPositionInLine())              ),              effect, -            new ArrayList<ValueNode>(), +            new ArrayList<Computation>(),              ($paragraph.result)           );     } @@ -1356,10 +1356,10 @@ catch [final Throwable e]  }  field_value_list -returns [List<Cons<Origin, Cons<String, ValueNode>>> result] +returns [List<Cons<Origin, Cons<String, Computation>>> result]  @init  { -   $result = new ArrayList<Cons<Origin, Cons<String, ValueNode>>>(); +   $result = new ArrayList<Cons<Origin, Cons<String, Computation>>>();  }  :     ( @@ -1428,7 +1428,7 @@ catch [final Throwable e]  /**** VALUES ******************************************************************/  /******************************************************************************/  boolean_expression -returns [ValueNode result]: +returns [Computation result]:     TRUE_KW     {        $result = @@ -1635,7 +1635,7 @@ catch [final Throwable e]  }  math_expression -returns [ValueNode result]: +returns [Computation result]:     PLUS_KW value_list WS* R_PAREN     {        $result = @@ -1754,7 +1754,7 @@ catch [final Throwable e]  }  value -returns [ValueNode result] +returns [Computation result]  :     WORD     { @@ -1799,7 +1799,7 @@ returns [ValueNode result]                 ($WORD.getCharPositionInLine())              ),              effect, -            new ArrayList<ValueNode>(), +            new ArrayList<Computation>(),              ($paragraph.result)           );     } @@ -1870,7 +1870,7 @@ catch [final Throwable e]  }  non_text_value -returns [ValueNode result] +returns [Computation result]  :     IF_ELSE_KW cond=value WS+ if_true=value WS+ if_false=value WS* R_PAREN     { @@ -1957,7 +1957,7 @@ returns [ValueNode result]     | EXTENSION_VALUE_KW WORD WS+ value_list WS* R_PAREN     {        final Origin origin; -      final ExtensionValueNode value; +      final ExtensionComputation value;        origin =           CONTEXT.get_origin_at @@ -2231,10 +2231,10 @@ catch [final Throwable e]  }  value_cond_list -returns [List<Cons<ValueNode, ValueNode>> result] +returns [List<Cons<Computation, Computation>> result]  @init  { -   $result = new ArrayList<Cons<ValueNode, ValueNode>>(); +   $result = new ArrayList<Cons<Computation, Computation>>();  }  :     ( @@ -2248,10 +2248,10 @@ returns [List<Cons<ValueNode, ValueNode>> result]  ;  value_list -returns [List<ValueNode> result] +returns [List<Computation> result]  @init  { -   $result = new ArrayList<ValueNode>(); +   $result = new ArrayList<Computation>();  }  :     ( diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/Compiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/Compiler.java new file mode 100644 index 0000000..39707da --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/Compiler.java @@ -0,0 +1,104 @@ +package tonkadur.wyrd.v1.compiler.fate.v1; + +import tonkadur.error.Error; + +import tonkadur.wyrd.v1.lang.World; + +public class Compiler +{ +   /* Utility Class */ +   private Compiler () { } + +   public static World compile (final tonkadur.fate.v1.lang.World fate_world) +   throws Error +   { +      final World wyrd_world; + +      wyrd_world = new World(); + +      compile_extensions(fate_world, wyrd_world); +      compile_types(fate_world, wyrd_world); +      compile_variables(fate_world, wyrd_world); +      compile_sequences(fate_world, wyrd_world); +      compile_main_sequence(fate_world, wyrd_world); + +      return wyrd_world; +   } + +   protected static void compile_extensions +   ( +      final tonkadur.fate.v1.lang.World fate_world, +      final World wyrd_world +   ) +   { +      for (final String extension: fate_world.get_required_extensions()) +      { +         wyrd_world.add_required_extension(extension); +      } +   } + +   protected static void compile_types +   ( +      final tonkadur.fate.v1.lang.World fate_world, +      final World wyrd_world +   ) +   throws Error +   { +      for +      ( +         final tonkadur.fate.v1.lang.type.Type type: +            fate_world.types().get_all() +      ) +      { +         TypeCompiler.compile(type, wyrd_world); +      } +   } + +   protected static void compile_variables +   ( +      final tonkadur.fate.v1.lang.World fate_world, +      final World wyrd_world +   ) +   throws Error +   { +      for +      ( +         final tonkadur.fate.v1.lang.Variable variable: +            fate_world.variables().get_all() +      ) +      { +         VariableCompiler.compile(variable, wyrd_world); +      } +   } + +   protected static void compile_sequences +   ( +      final tonkadur.fate.v1.lang.World fate_world, +      final World wyrd_world +   ) +   throws Error +   { +      for +      ( +         final tonkadur.fate.v1.lang.Sequence sequence: +            fate_world.sequences().get_all() +      ) +      { +         SequenceCompiler.compile(sequence, wyrd_world); +      } +   } + +   protected static void compile_main_sequence +   ( +      final tonkadur.fate.v1.lang.World fate_world, +      final World wyrd_world +   ) +   throws Error +   { +      SequenceCompiler.compile_main_sequence +      ( +         fate_world.get_global_instructions(), +         wyrd_world +      ); +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java new file mode 100644 index 0000000..af82748 --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/ComputationCompiler.java @@ -0,0 +1,190 @@ +package tonkadur.wyrd.v1.compiler.fate.v1; + +import tonkadur.error.Error; + +import tonkadur.wyrd.v1.lang.meta.Computation; + +import tonkadur.wyrd.v1.lang.World; + +public class ComputationCompiler extends FateVisitor +{ +   protected final World wyrd_world; +   protected final List<Instruction> pre_computation_instructions; + +   public ComputationCompiler (final World wyrd_world) +   { +      this.wyrd_world = wyrd_world; + +      pre_computation_instructions = new ArrayList<Instruction>(); +   } + +   @Override +   public void visit_at_reference +   ( +      final tonkadur.fate.v1.lang.valued_node.AtReference n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_cast +   ( +      final tonkadur.fate.v1.lang.valued_node.Cast n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_cond_value +   ( +      final tonkadur.fate.v1.lang.valued_node.CondValue n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_constant +   ( +      final tonkadur.fate.v1.lang.valued_node.Constant n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_count_operator +   ( +      final tonkadur.fate.v1.lang.valued_node.CountOperator n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_field_reference +   ( +      final tonkadur.fate.v1.lang.valued_node.FieldReference n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_if_else_value +   ( +      final tonkadur.fate.v1.lang.valued_node.IfElseValue n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_is_member_operator +   ( +      final tonkadur.fate.v1.lang.valued_node.IsMemberOperator n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_macro_value_call +   ( +      final tonkadur.fate.v1.lang.valued_node.MacroValueCall n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_newline +   ( +      final tonkadur.fate.v1.lang.valued_node.Newline n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_operation +   ( +      final tonkadur.fate.v1.lang.valued_node.Operation n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_paragraph +   ( +      final tonkadur.fate.v1.lang.valued_node.Paragraph n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_parameter_reference +   ( +      final tonkadur.fate.v1.lang.valued_node.ParameterReference n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_ref_operator +   ( +      final tonkadur.fate.v1.lang.valued_node.RefOperator n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_text_with_effect +   ( +      final tonkadur.fate.v1.lang.valued_node.TextWithEffect n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_value_to_rich_text +   ( +      final tonkadur.fate.v1.lang.valued_node.ValueToRichText n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_variable_reference +   ( +      final tonkadur.fate.v1.lang.valued_node.VariableReference n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/visitor/fate/v1/FateVisitor.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/FateVisitor.java index ecdce81..c84d5e7 100644 --- a/src/core/src/tonkadur/wyrd/v1/visitor/fate/v1/FateVisitor.java +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/FateVisitor.java @@ -1,4 +1,4 @@ -package tonkadur.wyrd.v1.visitor.fate.v1; +package tonkadur.wyrd.v1.compiler.fate.v1;  import tonkadur.wyrd.v1.error.UnhandledASTElementException; @@ -6,12 +6,6 @@ import tonkadur.fate.v1.lang.meta.NodeVisitor;  public abstract class FateVisitor implements NodeVisitor  { -   public void visit_world (final tonkadur.fate.v1.lang.World w) -   throws Throwable -   { -      throw new UnhandledASTElementException(); -   } -     /* Instruction Nodes */     public void visit_add_element     ( diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java new file mode 100644 index 0000000..2e49ae9 --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/InstructionCompiler.java @@ -0,0 +1,587 @@ +package tonkadur.wyrd.v1.compiler.fate.v1; + +import tonkadur.error.Error; + +import tonkadur.wyrd.v1.lang.meta.Instruction; + +import tonkadur.wyrd.v1.lang.World; + +public class InstructionCompiler extends FateVisitor +{ +   protected final AnonymousVariableManager anonymous_variables; +   protected final World wyrd_world; +   protected final List<Instruction> result; + +   public InstructionCompiler +   ( +      final AnonymousVariableManager anonymous_variables, +      final World wyrd_world +   ) +   { +      this.anonymous_variables = anonymous_variables; +      this.wyrd_world = wyrd_world; +      result = new ArrayList<Instruction>(); +   } + +   public InstructionCompiler +   ( +      final AnonymousVariableManager anonymous_variables, +      final World wyrd_world, +      final List<Instruction> result +   ) +   { +      this.anonymous_variables = anonymous_variables; +      this.wyrd_world = wyrd_world; +      this.result = result; +   } + +   protected static void add_element_to_set +   ( +      final tonkadur.fate.v1.lang.instruction.AddElement ae +   ) +   throws Throwable +   { +      /* +       * Fate: +       * (add_element element collection) +       * +       * Wyrd: +       * (declare_variable local <element.type> .anon0) +       * (set .anon0 element) +       * (declare_variable local boolean .found) +       * <binary_search .anon0 collection .found .index> +       * (ifelse (var .found) +       *    (nop) +       *    (set .end (size collection)) +       * +       *    (while (> .index .end) +       *       (set .next (- (val .end) 1)) +       *       (set collection[.index] collection[.next]) +       *       (set .end (val .next)) +       *    ) +       * ) +       */ +      final Ref element_as_ref, collection_as_ref, collection_size_as_ref; +      final Ref element_found, element_index, collection_size, next_index; +      final ComputationCompiler element_compiler, reference_compiler; +      final Type element_type; +      final List<Instruction> while_body, else_branch; + +      /**** Getting the Element as a ref ****/ +      element_compiler = +         new ComputationCompiler +         ( +            anonymous_variables, +            wyrd_world +         ); + +      ae.get_element().visit(element_compiler); + +      result.addAll(element_compiler.get_pre_instructions()); + +      element_type = element_compiler.get_computation().get_type(); + +      element_as_ref = anonymous_variable.reserve(element_type); + +      result.add +      ( +         new SetValue(element_as_ref, element_compiler.get_computation()) +      ); + +      /**** Getting the Collection as a ref ****/ +      reference_compiler = +         new ComputationCompiler +         ( +            anonymous_variables, +            wyrd_world +         ); + +      ae.get_collection().visit(reference_compiler); + +      result.addAll(reference_compiler.get_pre_instructions()); + +      if (!(reference_compiler.get_computation() instanceof Ref)) +      { +         /* TODO: error. */ +      } + +      collection_as_ref = (Ref) reference_compiler.get_computation(); + +      /**** Finding the element in the collection ****/ +      element_found = anonymous_variable.reserve(Type.BOOLEAN); +      element_index = anonymous_variable.reserve(Type.INT); +      collection_size = anonymous_variable.reserve(Type.INT); +      next_index = anonymous_variable.reserve(Type.INT); + +      result.add +      ( +         new SetValue(collection_size, new Size(collection_as_ref)) +      ); + +      result.addAll +      ( +         BinarySearch.generate +         ( +            anonymous_variables, +            element_as_ref, +            collection_as_ref, +            collection_size, +            element_found, +            element_index +         ) +      ); + +      while_body = new ArrayList<Instruction>(); + +      while_body.add +      ( +         new SetValue +         ( +            next_index, +            Operation.minus +            ( +               new ValueOf(collection_size), +               new Constant(Type.INT, "1") +            ) +         ) +      ); + +      while_body.add +      ( +         new SetValue +         ( +            new RelativeRef +            ( +               collection_as_ref, +               Collections.singletonList +               ( +                  new Cast +                  ( +                     new ValueOf(collection_size), +                     Type.STRING +                  ) +               ), +               element_type +            ), +            new ValueOf +            ( +               new RelativeRef +               ( +                  collection_as_ref, +                  Collections.singletonList +                  ( +                     new Cast +                     ( +                        new ValueOf(next), +                        Type.STRING +                     ) +                  ), +                  element_type +               ) +            ) +         ) +      ); + +      while_body.add +      ( +         new SetValue +         ( +            collection_size, +            new ValueOf(next) +         ) +      ); + +      else_branch = new ArrayList<Instruction>(); + +      else_branch.add +      ( +         new While +         ( +            Operation.less_than +            ( +               new ValueOf(element_index), +               new ValueOf(collection_size) +            ), +            while_body +         ) +      ); + +      else_branch.add +      ( +         new SetValue +         ( +            new RelativeRef +            ( +               collection_as_ref, +               Collections.singletonList +               ( +                  new Cast +                  ( +                     new ValueOf(element_index), +                     Type.STRING +                  ) +               ), +               element_type +            ), +            new ValueOf(element_as_ref) +         ) +      ); + +      result.add +      ( +         new IfElseInstruction +         ( +            new ValueOf(element_found), +            new NOP(), +            else_branch +         ) +      ); + +      anonymous_variables.release(element_as_ref); +      anonymous_variables.release(element_found); +      anonymous_variables.release(element_index); +      anonymous_variables.release(collection_size); +      anonymous_variables.release(next_index); + +      reference_compiler.free_anonymous_variables(); +      element_compiler.free_anonymous_variables(); +   } + +   protected static void add_element_to_list +   ( +      final tonkadur.fate.v1.lang.instruction.AddElement ae +   ) +   throws Throwable +   { +      /* +       * Fate: +       * (add_element element collection) +       * +       * Wyrd: +       * (set +       *    (relative_ref collection ( (cast int string (size collection)) )) +       *    (element) +       * ) +       */ +      final Ref collection_as_ref; +      final ComputationCompiler element_compiler, reference_compiler; + +      element_compiler = +         new ComputationCompiler +         ( +            anonymous_variables, +            wyrd_world +         ); + +      ae.get_element().visit(element_compiler); + +      reference_compiler = +         new ComputationCompiler +         ( +            anonymous_variables, +            wyrd_world +         ); + +      ae.get_collection().visit(reference_compiler); + +      if (!(reference_compiler.get_computation() instanceof Ref)) +      { +         /* TODO: error. */ +      } + +      collection_as_ref = (Ref) reference_compiler.get_computation(); + +      result.addAll(reference_compiler.get_pre_instructions()); +      result.addAll(element_compiler.get_pre_instructions()); +      result.add +      ( +         new SetValue +         ( +            new RelativeRef +            ( +               collection_as_ref, +               Collections.singletonList +               ( +                  new Cast +                  ( +                     new Size(reference_compiler.get_computation()), +                     Type.STRING +                  ) +               ) +            ) +            element_compiler.get_computation() +         ) +      ); + +      reference_compiler.free_anonymous_variables(); +      element_compiler.free_anonymous_variables(); +   } + +   @Override +   public void visit_add_element +   ( +      final tonkadur.fate.v1.lang.instruction.AddElement ae +   ) +   throws Throwable +   { +      final tonkadur.fate.v1.lang.type.Type collection_type; +      final tonkadur.fate.v1.lang.type.CollectionType collection_true_type; + +      collection_type = ae.get_collection.get_type(); + +      if +      ( +         !(collection_type instanceof tonkadur.fate.v1.lang.type.CollectionType) +      ) +      { +         /* TODO: error */ +      } + +      collection_true_type = +         (tonkadur.fate.v1.lang.type.CollectionType) collection_type; + +      if (collection_true_type.is_set()) +      { +         add_element_to_set(ae); +      } +      else +      { +         add_element_to_list(ae); +      } +   } + +   @Override +   public void visit_assert (final tonkadur.fate.v1.lang.instruction.Assert a) +   throws Throwable +   { +      final ComputationCompiler cc; + +      cc = new ComputationCompiler(wyrd_world); + +      a.get_condition().visit(cc); + +      result.addAll(cc.get_pre_instructions()); +      result.add(new Assert(cc.get_computation())); + +      cc.free_anonymous_variables(); +   } + +   @Override +   public void visit_clear (final tonkadur.fate.v1.lang.instruction.Clear c) +   throws Throwable +   { +      final ComputationCompiler reference_compiler; +      final Ref iterator, collection_ref; +      final List<Instruction> while_body; + +      reference_compiler = +         new ComputationCompiler(anonymous_variables, wyrd_world); + +      c.get_collection().visit(reference_compiler); + +      iterator = anonymous_variables.reserve(Type.INT); + +      if (!(reference_compiler.get_computation() instanceof Ref)) +      { +         /* TODO: error. */ +      } + +      collection_ref = (Ref) reference_compiler.get_computation(); + +      while_body.add +      ( +         new Remove(new ValueOf(iterator), collection_ref) +      ); + +      while_body.add +      ( +         new SetValue +         ( +            iterator, +            Operation.minus(new ValueOf(iterator), new Constant(Type.INT, "1")) +         ) +      ); + +      result.add +      ( +         new While +         ( +            Operation.greater_equal_than +            ( +               new ValueOf(iterator), +               new Constant(Type.INT, "0") +            ), +            while_body +         ) +      ); + +      anonymous_variables.release(iterator); +   } + +   @Override +   public void visit_cond_instruction +   ( +      final tonkadur.fate.v1.lang.instruction.CondInstruction ci +   ) +   throws Throwable +   { +      InstructionCompiler ic; +      ComputationCompiler cc; +      List<Instruction> previous_else_branch; +      List<Instruction> current_else_branch; + +      previous_else_branch = results; + +      for +      ( +         final +         Cons +         < +            tonkadur.fate.v1.lang.instruction.meta.Computation, +            tonkadur.fate.v1.lang.instruction.meta.Instruction +         > +         branch: +            ci.get_branches() +      ) +      { +         current_else_branch = new ArrayList<Instruction>(); + +         ic = new InstructionCompiler(anonymous_variables, wyrd_world); +         cc = new ComputationCompiler(anonymous_variables, wyrd_world); + +         branch.get_car().visit(cc); + +         previous_else_branch.addAll(cc.get_pre_instructions()); +         previous_else_branch.add +         ( +            new IfElseInstruction +            ( +               cc.get_computation(), +               ic.get_result(), +               current_else_branch +            ) +         ); + +         previous_else_branch = current_else_branch; +      } + +      previous_else_branch.add(Collections.singleton(new NOP()); +   } + +   @Override +   public void visit_display (final tonkadur.fate.v1.lang.instruction.Display n) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_event_call +   ( +      final tonkadur.fate.v1.lang.instruction.EventCall n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_if_else_instruction +   ( +      final tonkadur.fate.v1.lang.instruction.IfElseInstruction n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_if_instruction +   ( +      final tonkadur.fate.v1.lang.instruction.IfInstruction n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_instruction_list +   ( +      final tonkadur.fate.v1.lang.instruction.InstructionList n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_macro_call +   ( +      final tonkadur.fate.v1.lang.instruction.MacroCall n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_player_choice +   ( +      final tonkadur.fate.v1.lang.instruction.PlayerChoice n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_player_choice_list +   ( +      final tonkadur.fate.v1.lang.instruction.PlayerChoiceList n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_remove_all_of_element +   ( +      final tonkadur.fate.v1.lang.instruction.RemoveAllOfElement n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_remove_element +   ( +      final tonkadur.fate.v1.lang.instruction.RemoveElement n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_sequence_call +   ( +      final tonkadur.fate.v1.lang.instruction.SequenceCall n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } + +   @Override +   public void visit_set_value +   ( +      final tonkadur.fate.v1.lang.instruction.SetValue n +   ) +   throws Throwable +   { +      throw new UnhandledASTElementException(); +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/SequenceCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/SequenceCompiler.java new file mode 100644 index 0000000..d5fd3e2 --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/SequenceCompiler.java @@ -0,0 +1,48 @@ +package tonkadur.wyrd.v1.compiler.fate.v1; + +import tonkadur.error.Error; + +import tonkadur.wyrd.v1.lang.Sequence; + +import tonkadur.wyrd.v1.lang.World; + +public class SequenceCompiler +{ +   /* Utility Class */ +   private SequenceCompiler () { } + +   public static Sequence compile +   ( +      tonkadur.fate.v1.lang.Sequence fate_sequence, +      final World wyrd_world +   ) +   throws Error +   { +      Sequence result; + +      result = wyrd_world.get_sequence(fate_sequence.get_name()); + +      if (result != null) +      { +         return result; +      } + +      /* TODO */ +      result = null; + +      wyrd_world.add_sequence(result); + +      return result; +   } + +   public static List<Instruction> compile_main_sequence +   ( +      List<tonkadur.fate.v1.lang.meta.Instruction> fate_instruction_list, +      final World wyrd_world +   ) +   throws Error +   { +      /* TODO */ +      return null; +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/TypeCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/TypeCompiler.java new file mode 100644 index 0000000..b77824f --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/TypeCompiler.java @@ -0,0 +1,149 @@ +package tonkadur.wyrd.v1.compiler.fate.v1; + +import tonkadur.error.Error; + +import tonkadur.wyrd.v1.lang.type.*; + +import tonkadur.wyrd.v1.lang.World; + + +public class TypeCompiler +{ +   /* Utility Class */ +   private TypeCompiler () { } + +   public static Type compile +   ( +      tonkadur.fate.v1.lang.type.Type fate_type, +      final World wyrd_world +   ) +   throws Error +   { +      if (fate_type instanceof tonkadur.fate.v1.lang.type.DictType) +      { +         return +            compile_dict_type +            ( +               (tonkadur.fate.v1.lang.type.DictType) fate_type, +               wyrd_world +            ); +      } + +      if (fate_type instanceof tonkadur.fate.v1.lang.type.CollectionType) +      { +         return +            compile_collection_type +            ( +               (tonkadur.fate.v1.lang.type.CollectionType) fate_type, +               wyrd_world +            ); +      } + +      if (fate_type instanceof tonkadur.fate.v1.lang.type.RefType) +      { +         return Type.POINTER; +      } + +      fate_type = fate_type.get_base_type(); + +      if (fate_type.equals(tonkadur.fate.v1.lang.type.BOOLEAN)) +      { +         return Type.BOOLEAN; +      } + +      if (fate_type.equals(tonkadur.fate.v1.lang.type.FLOAT)) +      { +         return Type.FLOAT; +      } + +      if (fate_type.equals(tonkadur.fate.v1.lang.type.INT)) +      { +         return Type.INT; +      } + +      if (fate_type.equals(tonkadur.fate.v1.lang.type.RICH_TEXT)) +      { +         return Type.RICH_TEXT; +      } + +      if (fate_type.equals(tonkadur.fate.v1.lang.type.STRING)) +      { +         return Type.STRING; +      } + +      /* TODO: throw error. */ +      return null; +   } + +   protected static Type compile_dict_type +   ( +      final tonkadur.fate.v1.lang.type.DictType fate_dict_type, +      final World wyrd_world +   ) +   throws Error +   { +      DictType result; +      final Map<String, Type> fields; + +      result = wyrd_world.get_dict_type(fate_dict_type.get_name()); + +      if (result != null) +      { +         return result; +      } + +      fields = new HashMap<String, Type>(); + +      for +      ( +         final Map.Entry<String, tonkadur.fate.v1.lang.type.Type> field: +            fate_dict_type.get_fields() +      ) +      { +         fields.put(field.getKey(), compile(field.getValue(), wyrd_world)); +      } + +      result = new DictType(fate_dict_type.get_name(), fields); + +      wyrd_world.add_dict_type(result); + +      return result; +   } + +   protected static Type compile_collection_type +   ( +      final tonkadur.fate.v1.lang.type.CollectionType fate_collection_type, +      final World wyrd_world +   ) +   throws Error +   { +      final tonkadur.fate.v1.lang.type.Type fate_content_type; + +      fate_content_type = +         fate_collection_type.get_content_type().get_base_type(); + +      if (fate_content_type.equals(tonkadur.fate.v1.lang.type.BOOLEAN)) +      { +         return MapType.MAP_TO_BOOLEAN; +      } + +      if (fate_content_type.equals(tonkadur.fate.v1.lang.type.FLOAT)) +      { +         return MapType.MAP_TO_FLOAT; +      } + +      if (fate_content_type.equals(tonkadur.fate.v1.lang.type.INT)) +      { +         return MapType.MAP_TO_INT; +      } + +      if (fate_content_type.equals(tonkadur.fate.v1.lang.type.STRING)) +      { +         return MapType.MAP_TO_STRING; +      } + +      /* TODO: error */ + +      return null; +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/VariableCompiler.java b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/VariableCompiler.java new file mode 100644 index 0000000..6078d54 --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/fate/v1/VariableCompiler.java @@ -0,0 +1,42 @@ +package tonkadur.wyrd.v1.compiler.fate.v1; + +import tonkadur.error.Error; + +import tonkadur.wyrd.v1.lang.Variable; + +import tonkadur.wyrd.v1.lang.World; + +public class VariableCompiler +{ +   /* Utility Class */ +   private VariableCompiler () { } + +   public static Variable compile +   ( +      tonkadur.fate.v1.lang.Variable fate_variable, +      final World wyrd_world +   ) +   throws Error +   { +      Variable result; + +      result = wyrd_world.get_variable(fate_variable.get_name()); + +      if (result != null) +      { +         return result; +      } + +      result = +         new Variable +         ( +            fate_variable.get_name(), +            fate_variable.get_scope().toString(), +            TypeCompiler.compile(fate_variable.get_type()) +         ); + +      wyrd_world.add_variable(result); + +      return result; +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/util/AnonymousVariableManager.java b/src/core/src/tonkadur/wyrd/v1/compiler/util/AnonymousVariableManager.java new file mode 100644 index 0000000..14719c2 --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/util/AnonymousVariableManager.java @@ -0,0 +1,76 @@ +package tonkadur.wyrd.v1.compiler.util; + +import java.util.Map; +import java.util.HashMap; +import java.util.List; +import java.util.ArrayList; + +import tonkadur.functional.Cons; + +import tonkadur.wyrd.v1.lang.Type; +import tonkadur.wyrd.v1.lang.Variable; + +public class AnonymousVariableManager +{ +   protected static final String name_prefix = ".anon."; + +   protected final Map<String, Cons<Boolean, Variable>> by_name; +   protected final Map<Type, List<Cons<Boolean, Variable>>> by_type; +   protected int generated_variables; + +   public AnonymousVariableManager () +   { +      by_name = new HashMap<String, Cons<Boolean, Variable>>(); +      by_type = new HashMap<Type, List<Cons<Boolean, Variable>>>(); +      generated_variables = 0; +   } + +   public Ref reserve (final Type t) +   { +      final Ref result; +      final Variable new_variable; +      List<Cons<Boolean, Variable>> list; + +      list = by_type.get(t); + +      if (list == null) +      { +         list = new ArrayList<Cons<Boolean, Variable>>(); + +         by_type.put(t, list); +      } + +      for (final Cons<Boolean, Variable> entry: list) +      { +         if (!entry.get_car()) +         { +            result = entry.get_cdr().get_ref(); + +            entry.set_cdr(Boolean.TRUE); + +            return result; +         } +      } + +      new_variable = +         new Variable +         ( +            (name_prefix + Integer.toString(generated_variables)), +            "local", +            t +         ); + +      list.add(new Cons(Boolean.TRUE, new_variable)); + +      return new_variable.get_ref(); +   } + +   public void release (final Ref r) +   { +      final String name; + +      name = r.get_accesses().get(0).get_as_string(); + +      by_name.get(name).set_car(Boolean.FALSE); +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/compiler/util/BinarySearch.java b/src/core/src/tonkadur/wyrd/v1/compiler/util/BinarySearch.java new file mode 100644 index 0000000..6c731b9 --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/compiler/util/BinarySearch.java @@ -0,0 +1,212 @@ +package tonkadur.wyrd.v1.compiler.util; + +import java.util.List; +import java.util.ArrayList; +import java.util.Collections; + +import tonkadur.wyrd.v1.lang.type.Type; + +import tonkadur.wyrd.v1.lang.computation.Cast; +import tonkadur.wyrd.v1.lang.computation.Constant; +import tonkadur.wyrd.v1.lang.computation.Operation; +import tonkadur.wyrd.v1.lang.computation.Ref; +import tonkadur.wyrd.v1.lang.computation.ValueOf; + +import tonkadur.wyrd.v1.lang.instruction.IfElseInstruction; +import tonkadur.wyrd.v1.lang.instruction.SetValue; +import tonkadur.wyrd.v1.lang.instruction.While; + +public class BinarySearch +{ +   /* +      (set .found false) +      (declare_variable local int .top) +      (set .top (- (size collection) 1)) +      (declare_variable local int .bot) +      (set .bot 0) +      (declare_variable local int .mid) +      (declare_variable local <element.type> .midval) +      (while (and (not (var .found)) (<= (variable .bot) (variable .top))) +         (set .mid +            (+ +               (variable .bot) +               (cast float int +                  (/ +                     (cast int float (- (variable .top) (variable .bot))) +                     2.0 +                  ) +               ) +            ) +         ) +         (set .midval +            (value_of +               (relative_ref collection ( (cast int string .mid) )) +            ) +         ) +         (ifelse (< (variable .midval) (variable .anon1)) +            (set .bot (+ (var .mid) 1)) +            (ifelse (> (var .midval) (variable .anon1)) +               (set .top (- (var .mid) 1)) +               (set .found true) +            ) +         ) +      ) +   */ +   public static List<Instruction> generate +   ( +      final AnonymousVariableManager anonymous_variables, +      final Ref target, +      final Ref collection, +      final Ref collection_size_or_null, +      final Ref result_was_found_holder, +      final Ref result_index_holder +   ) +   { +      final List<Instruction> result, while_body; +      final Ref top, bot, midval; + +      result = new ArrayList<Instruction>(); +      while_body = new ArrayList<Instruction>(); + +      top = anonymous_variables.reserve(Type.INT); +      bot = anonymous_variables.reserve(Type.INT); +      midval = anonymous_variables.reserve(target.get_type()); + +      result.add(new SetValue(result_holder, Constant.FALSE)); +      result.add +      ( +         new SetValue +         ( +            top, +            Operation.minus +            ( +               ( +                  (collection_size_or_null == null) ? +                  new Size(collection) : new ValueOf(collection_size_or_null) +               ), +               new Constant(Type.INT, "1") +            ) +         ) +      ); +      result.add +      ( +         new SetValue(bot, new Constant(Type.INT, "0")) +      ); + +      while_body.add +      ( +         new SetValue +         ( +            result_index_holder, +            Operation.plus +            ( +               new ValueOf(bot) +               new Cast +               ( +                  Operation.divide +                  ( +                     new Cast +                     ( +                        Operation.minus +                        ( +                           new ValueOf(top) +                           new ValueOf(bot) +                        ) +                        Type.FLOAT +                     ), +                     2 +                  ) +                  Type.INT +               ) +            ) +         ) +      ); +      while_body.add +      ( +         new SetValue +         ( +            midval, +            new ValueOf +            ( +               new RelativeRef +               ( +                  collection, +                  Collections.singletonList +                  ( +                     new Cast(new ValueOf(result_index_holder), Type.STRING) +                  ) +               ) +            ) +         ) +      ); +      while_body.add +      ( +         new IfElseInstruction +         ( +            Operation.less_than(new ValueOf(midval), new ValueOf(target)), +            Collections.singletonList +            ( +               new SetValue +               ( +                  bot, +                  Operation.plus +                  ( +                     new ValueOf(result_index_holder), +                     new Constant(Type.INT, "1") +                  ) +               ) +            ), +            Collections.singletonList +            ( +               new IfElseInstruction +               ( +                  Operation.greater_than +                  ( +                     new ValueOf(midval), +                     new ValueOf(target) +                  ), +                  Collections.singletonList +                  ( +                     new SetValue +                     ( +                        top, +                        Operation.minus +                        ( +                           new ValueOf(result_index_holder), +                           new Constant(Type.INT, "1") +                        ) +                     ) +                  ), +                  Collections.singletonList +                  ( +                     new SetValue(result_holder, Constant.TRUE) +                  ) +               ) +            ) +         ) +      ); + +      result.add +      ( +         new While +         ( +            Operation.and +            ( +               Operation.not(new ValueOf(result_holder)), +               Operation.less_equal_than +               ( +                  new ValueOf(bot), +                  new ValueOf(top) +               ) +            ), +            while_body +         ) +      ); + +      anonymous_variables.release(top); +      anonymous_variables.release(bot); +      anonymous_variables.release(midval); + +      return result; +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/lang/Variable.java b/src/core/src/tonkadur/wyrd/v1/lang/Variable.java index 2ee4495..25bd2e1 100644 --- a/src/core/src/tonkadur/wyrd/v1/lang/Variable.java +++ b/src/core/src/tonkadur/wyrd/v1/lang/Variable.java @@ -29,4 +29,14 @@ public class Variable     {        return type;     } + +   public Ref get_ref () +   { +      return +         new Ref +         ( +            Collections.singletonList(new Constant(Type.STRING, name)), +            type +         ); +   }  } diff --git a/src/core/src/tonkadur/wyrd/v1/lang/computation/Constant.java b/src/core/src/tonkadur/wyrd/v1/lang/computation/Constant.java index 283f567..c54923d 100644 --- a/src/core/src/tonkadur/wyrd/v1/lang/computation/Constant.java +++ b/src/core/src/tonkadur/wyrd/v1/lang/computation/Constant.java @@ -6,6 +6,15 @@ import tonkadur.wyrd.v1.lang.meta.Computation;  public class Constant extends Computation  { +   public static final Constant TRUE; +   public static final Constant FALSE; + +   static +   { +      TRUE = new Constant(Type.BOOLEAN, "true"); +      FALSE = new Constant(Type.BOOLEAN, "false"); +   } +     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ diff --git a/src/core/src/tonkadur/wyrd/v1/lang/computation/Operation.java b/src/core/src/tonkadur/wyrd/v1/lang/computation/Operation.java index 994138a..a680188 100644 --- a/src/core/src/tonkadur/wyrd/v1/lang/computation/Operation.java +++ b/src/core/src/tonkadur/wyrd/v1/lang/computation/Operation.java @@ -8,11 +8,165 @@ import tonkadur.wyrd.v1.lang.meta.Computation;  public class Operation extends Computation  { +   /* Math operations *********************************************************/ +   public static final String DIVIDE = "divide"; +   public static final String MINUS = "minus"; +   public static final String PLUS = "plus"; +   public static final String POWER = "power"; +   public static final String RANDOM = "rand"; +   public static final String TIMES = "times"; + +   /* Logic operations ********************************************************/ +   public static final String AND = "and"; +   public static final String OR = "or"; +   public static final String NOT = "not"; +   public static final String IMPLIES = "implies"; + +   /* Comparison operations ***************************************************/ +   public static final String LESS_THAN = "less_than"; +   public static final String LESS_EQUAL_THAN = "less_equal_than"; +   public static final String EQUALS = "equals"; +   public static final String GREATER_EQUAL_THAN = "greater_equal_than"; +   public static final String GREATER_THAN = "greather_than"; + +   public static Operation divide +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(DIVIDE, param_a.get_type(), param_a, param_b); +   } + +   public static Operation minus +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(MINUS, param_a.get_type(), param_a, param_b); +   } + +   public static Operation plus +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(PLUS, param_a.get_type(), param_a, param_b); +   } + +   public static Operation times +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(TIMES, param_a.get_type(), param_a, param_b); +   } + +   public static Operation power +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(POWER, param_a.get_type(), param_a, param_b); +   } + +   public static Operation rand +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(RAND, Type.INT, param_a, param_b); +   } + +   /* Logic operations ********************************************************/ +   public static Operation and +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(AND, Type.BOOLEAN, param_a, param_b); +   } + +   public static Operation or +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(OR, Type.BOOLEAN, param_a, param_b); +   } + +   public static Operation not (final Computation param_a) +   { +      return new Operation(NOT, Type.BOOLEAN, param_a, null); +   } + +   public static Operation implies +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(IMPLIES, Type.BOOLEAN, param_a, param_b); +   } + +   /* Comparison operations ***************************************************/ +   public static Operation less_than +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(LESS_THAN, Type.BOOLEAN, param_a, param_b); +   } + +   public static Operation less_equal_than +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(LESS_EQUAL_THAN, Type.BOOLEAN, param_a, param_b); +   } +   public static Operation equals +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(EQUALS, Type.BOOLEAN, param_a, param_b); +   } + +   public static Operation greater_than +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(GREATER_THAN, Type.BOOLEAN, param_a, param_b); +   } + +   public static Operation greater_equal_than +   ( +      final Computation param_a, +      final Computation param_b +   ) +   { +      return new Operation(GREATER_EQUAL_THAN, Type.BOOLEAN, param_a, param_b); +   } +     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/     protected final String operator; -   protected final List<Computation> parameters; +   protected final Computation param_a; +   protected final Computation param_b;     /***************************************************************************/     /**** PUBLIC ***************************************************************/ @@ -20,20 +174,27 @@ public class Operation extends Computation     /**** Constructors *********************************************************/     public Operation     ( -      final Type result_type,        final String operator, -      final List<Computation> parameters +      final Type result_type, +      final Computation param_a, +      final Computation param_b     )     {        super(result_type);        this.operator = operator; -      this.parameters = parameters; +      this.param_a = param_a; +      this.param_b = param_b;     }     /**** Accessors ************************************************************/ -   public List<Computation> get_parameters () +   public Computation get_first_parameter () +   { +      return param_a; +   } + +   public Computation get_secomd_parameter ()     { -      return parameters; +      return param_b;     }  } diff --git a/src/core/src/tonkadur/wyrd/v1/lang/computation/AbsoluteRef.java b/src/core/src/tonkadur/wyrd/v1/lang/computation/Ref.java index f0d6009..69aa905 100644 --- a/src/core/src/tonkadur/wyrd/v1/lang/computation/AbsoluteRef.java +++ b/src/core/src/tonkadur/wyrd/v1/lang/computation/Ref.java @@ -6,19 +6,19 @@ import tonkadur.wyrd.v1.lang.type.Type;  import tonkadur.wyrd.v1.lang.meta.Computation; -public class AbsoluteRef extends Computation +public class Ref extends Computation  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final List<String> accesses; +   protected final List<Computation> accesses;     protected final Type target_type;     /***************************************************************************/     /**** PUBLIC ***************************************************************/     /***************************************************************************/     /**** Constructors *********************************************************/ -   public AbsoluteRef (final List<String> accesses, final Type target_type) +   public Ref (final List<Computation> accesses, final Type target_type)     {        super(Type.POINTER); @@ -27,7 +27,7 @@ public class AbsoluteRef extends Computation     }     /**** Accessors ************************************************************/ -   public List<String> get_accesses () +   public List<Computation> get_accesses ()     {        return accesses;     } diff --git a/src/core/src/tonkadur/wyrd/v1/lang/computation/RelativeRef.java b/src/core/src/tonkadur/wyrd/v1/lang/computation/RelativeRef.java index 2de3a5d..bc39075 100644 --- a/src/core/src/tonkadur/wyrd/v1/lang/computation/RelativeRef.java +++ b/src/core/src/tonkadur/wyrd/v1/lang/computation/RelativeRef.java @@ -6,14 +6,12 @@ import tonkadur.wyrd.v1.lang.type.Type;  import tonkadur.wyrd.v1.lang.meta.Computation; -public class RelativeRef extends Computation +public class RelativeRef extends Ref  {     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final Computation parent; -   protected final List<String> accesses; -   protected final Type target_type; +   protected final Ref parent;     /***************************************************************************/     /**** PUBLIC ***************************************************************/ @@ -21,31 +19,19 @@ public class RelativeRef extends Computation     /**** Constructors *********************************************************/     public RelativeRef     ( -      final Computation parent, -      final List<String> accesses, +      final Ref parent, +      final List<Computation> accesses,        final Type target_type     )     { -      super(Type.POINTER); +      super(accesses, target_type);        this.parent = parent; -      this.accesses = accesses; -      this.target_type = target_type;     }     /**** Accessors ************************************************************/ -   public Computation get_parent () +   public Ref get_parent ()     {        return parent;     } - -   public List<String> get_accesses () -   { -      return accesses; -   } - -   public Type get_target_type () -   { -      return target_type; -   }  } diff --git a/src/core/src/tonkadur/wyrd/v1/lang/computation/Size.java b/src/core/src/tonkadur/wyrd/v1/lang/computation/Size.java index 22286d6..5559d0a 100644 --- a/src/core/src/tonkadur/wyrd/v1/lang/computation/Size.java +++ b/src/core/src/tonkadur/wyrd/v1/lang/computation/Size.java @@ -9,16 +9,13 @@ public class Size extends Computation     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final Computation collection; +   protected final Ref collection;     /***************************************************************************/     /**** PUBLIC ***************************************************************/     /***************************************************************************/     /**** Constructors *********************************************************/ -   public Size -   ( -      final Computation collection -   ) +   public Size (final Ref collection)     {        super(Type.INT); @@ -26,7 +23,7 @@ public class Size extends Computation     }     /**** Accessors ************************************************************/ -   public Computation get_collection () +   public Ref get_collection ()     {        return collection;     } diff --git a/src/core/src/tonkadur/wyrd/v1/lang/computation/ValueOf.java b/src/core/src/tonkadur/wyrd/v1/lang/computation/ValueOf.java index 7d214d8..c48c4e5 100644 --- a/src/core/src/tonkadur/wyrd/v1/lang/computation/ValueOf.java +++ b/src/core/src/tonkadur/wyrd/v1/lang/computation/ValueOf.java @@ -22,6 +22,13 @@ public class ValueOf extends Computation        this.parent = parent;     } +   public ValueOf (final Ref parent) +   { +      super(parent.get_target_type()); + +      this.parent = parent; +   } +     /**** Accessors ************************************************************/     public Computation get_parent ()     { diff --git a/src/core/src/tonkadur/wyrd/v1/lang/instruction/Remove.java b/src/core/src/tonkadur/wyrd/v1/lang/instruction/Remove.java new file mode 100644 index 0000000..6fb5e33 --- /dev/null +++ b/src/core/src/tonkadur/wyrd/v1/lang/instruction/Remove.java @@ -0,0 +1,36 @@ +package tonkadur.wyrd.v1.lang.computation; + +import tonkadur.wyrd.v1.lang.computation.Ref; + +import tonkadur.wyrd.v1.lang.meta.Instruction; +import tonkadur.wyrd.v1.lang.meta.Computation; + +public class Remove extends Instruction +{ +   /***************************************************************************/ +   /**** MEMBERS **************************************************************/ +   /***************************************************************************/ +   protected final Computation index; +   protected final Ref reference; + +   /***************************************************************************/ +   /**** PUBLIC ***************************************************************/ +   /***************************************************************************/ +   /**** Constructors *********************************************************/ +   public Remove (final Computation index, final Ref reference) +   { +      this.index = index; +      this.reference = reference; +   } + +   /**** Accessors ************************************************************/ +   public Computation get_index () +   { +      return index; +   } + +   public Ref get_reference () +   { +      return reference; +   } +} diff --git a/src/core/src/tonkadur/wyrd/v1/lang/instruction/SetValue.java b/src/core/src/tonkadur/wyrd/v1/lang/instruction/SetValue.java index 5842874..af6dc77 100644 --- a/src/core/src/tonkadur/wyrd/v1/lang/instruction/SetValue.java +++ b/src/core/src/tonkadur/wyrd/v1/lang/instruction/SetValue.java @@ -1,5 +1,7 @@  package tonkadur.wyrd.v1.lang.computation; +import tonkadur.wyrd.v1.lang.computation.Ref; +  import tonkadur.wyrd.v1.lang.meta.Instruction;  import tonkadur.wyrd.v1.lang.meta.Computation; @@ -8,21 +10,21 @@ public class SetValue extends Instruction     /***************************************************************************/     /**** MEMBERS **************************************************************/     /***************************************************************************/ -   protected final Computation reference; +   protected final Ref reference;     protected final Computation value;     /***************************************************************************/     /**** PUBLIC ***************************************************************/     /***************************************************************************/     /**** Constructors *********************************************************/ -   public SetValue (final Computation reference, final Computation value) +   public SetValue (final Ref reference, final Computation value)     {        this.reference = reference;        this.value = value;     }     /**** Accessors ************************************************************/ -   public Computation get_reference () +   public Ref get_reference ()     {        return reference;     } | 


