java_cup.interpreter
Class Exec

java.lang.Object
  |
  +--java_cup.interpreter.Exec

class Exec
extends java.lang.Object

Class containing the implementation of the dynamic semantics of EGO


Constructor Summary
(package private) Exec()
           
 
Method Summary
(package private) static Value exec_addMethod(Value location, Method_descriptor mdescr)
          adds a new method to the receiver object.
(package private) static Value exec_apply(Value method, Value argument)
          shows how a method is applied to its arguments.
(package private) static Value exec_changeLinearity(Value location)
          does not effect the memory.
(package private) static Value exec_clone(Value location)
          creates a new object from an existing one, location.
(package private) static Value exec_delegate(Value location, Value toDelegate)
          changes the reference to the super object of the receiver object.
(package private) static Value exec_invk(Value location, java.lang.String method_name)
          invokes a method on an object.
(package private) static Value exec(Value method_body)
          evaluates a not evaluated expression.
(package private) static void substitute(Value method_body, java.lang.String arg, Value argument)
          substitutes the variables with a value in an unevaluated expression.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Exec

Exec()
Method Detail

exec_clone

static Value exec_clone(Value location)
                 throws BadFormedExpressionException
creates a new object from an existing one, location. The list of methods and the address of the super object are copied from the cloned object to the newly created location.
Parameters:
location - is the cloned object.
Returns:
the new object created.

exec_addMethod

static Value exec_addMethod(Value location,
                            Method_descriptor mdescr)
                     throws BadFormedExpressionException
adds a new method to the receiver object. It also changes the body of method of the receiver if the method name is already defined.
Parameters:
location - the location of the receiver that will be added the method.
mdescr - the method added.
Returns:
the result returned is the modified location of the receiver.

exec_delegate

static Value exec_delegate(Value location,
                           Value toDelegate)
                    throws BadFormedExpressionException
changes the reference to the super object of the receiver object.
Parameters:
location - the location that will delegate to @see toDelegate
toDelegate - the location to be delegated
Returns:
the result of the reduction is the modified location of the receiver.

exec_invk

static Value exec_invk(Value location,
                       java.lang.String method_name)
                throws BadFormedExpressionException
invokes a method on an object. The method is owned by the receiver and is linear or nonlinear. As the type system does not allow another call to a linear method we remove it from the store. The location @see location is passed as an argument to the method because self is not a free variable in the lambda expression.
Parameters:
location - the receiver object
method_name - method name to be invoked
Returns:
the result of the reduction is a method apply with @see location as an argument and a store without the method @see method_name in it if @see method_name is linear or an unchanged store it @see method_name is nonlinear

exec_apply

static Value exec_apply(Value method,
                        Value argument)
                 throws BadFormedExpressionException
shows how a method is applied to its arguments.
Parameters:
method - the method to be applied to its argument @see argument
argument - the argument to be applied to @see method
Returns:
the result of replacing the argument in the method @see method by @see arguments in the method body of @see method

exec_changeLinearity

static Value exec_changeLinearity(Value location)
                           throws BadFormedExpressionException
does not effect the memory. It changes the linearity of an object from linear to non-linear.
Parameters:
location - location that will change the linearity
Returns:
the result of the reduction is the location passed as argument for the expression.

substitute

static void substitute(Value method_body,
                       java.lang.String arg,
                       Value argument)
substitutes the variables with a value in an unevaluated expression.
Parameters:
method_body - the expression where it will take place the substitution.
arg - the variable to be substituted
argument - the location that will substitute @see arg

exec

static Value exec(Value method_body)
           throws BadFormedExpressionException
evaluates a not evaluated expression.
Parameters:
method_body - the not evaluated expression
Returns:
the evaluated expression