Examples of CurrinRef


Examples of org.asturlinux.frade.currin.program.type.CurrinRef

 
  Vector _param_refs = new Vector();
  _param_refs = preparingParameters(m, run_parameters);
  logger.debug("We have " + _param_refs.size() + " params");

  CurrinRef f = (CurrinRef)_param_refs.get(0);
  CurrinFunction function = (CurrinFunction)f.getReference();

  String function_to_run = function.getId();
  Vector all_params_ref = new Vector(function.getRefParameters());
  logger.debug("Ready to run " + function_to_run);
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

  throws InterpreterException {


  Vector _param_refs = preparingParameters(m, run_parameters);

  CurrinRef first_op = (CurrinRef)_param_refs.get(0);
  CurrinRef second_op = (CurrinRef)_param_refs.get(1);

  first_op.evaluate(m);
  second_op.evaluate(m);

  int a = ((CurrinInt)first_op.getReference()).getValue();
  int b = ((CurrinInt)second_op.getReference()).getValue();

  m.setResult( new CurrinRef(new CurrinInt(a - b)));
  //System.out.println("Ejecutado 45 (-) y resultado en la maquina ");
    }
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

  throws InterpreterException {


  Vector _param_refs = preparingParameters(m, run_parameters);

  CurrinRef first_op = (CurrinRef)_param_refs.get(0);
  CurrinRef second_op = (CurrinRef)_param_refs.get(1);

 
  first_op = evaluateSubExpr(m, first_op);

  second_op = evaluateSubExpr(m, second_op);

  Memory mem = m.getContextStack().currentContext().getMemory();

  if ( first_op.equals(second_op,mem)) {
      m.setResult(new CurrinRef(new CurrinConstr("prelude__EQ",
                   new Vector() )));

  } else {
      if ( first_op.gt(second_op) )
    m.setResult(new CurrinRef(new CurrinConstr("prelude__GT",
                 new Vector())));
      else
    m.setResult(new CurrinRef(new CurrinConstr("prelude__LT",
                 new Vector())));
  }
    }
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

  Memory mem = m.getContextStack().currentContext().getMemory();
 
  try {

      while ( i.hasNext() ) {
    CurrinRef cr = mem.getElementAt((String)i.next());
    references.add(cr);
      }
     
      return references;
  } catch (ClassCastException cce) {
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

    public void testMemoryAllocation() {
   CurrinChar cc = new CurrinChar(65);
   CurrinExpr result;
   Memory m = new Memory();

  CurrinRef cr_char = new CurrinRef(cc);

   m.setElementAt("_1", cr_char);
   CurrinRef cr_result = m.getElementAt("_1");
   assertEquals("Escritura/lectura memoria", cr_result, cr_char);
    }
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

  _memory = new Memory();

  if ( function.getNumberOfParameters() != running_params.size()) {
     
      if ( function.getName().endsWith("IO") ) {
    CurrinRef cr = new CurrinRef(new CurrinConstr("empty",
                    new Vector()));
    running_params.add(cr);
      } else
    throw new InterpreterException("ERROR: Function "
                 + function.getName()
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

  _param_refs = new Vector();
  Iterator i = _param_names.iterator();
  while ( i.hasNext() ) {
      String where = (String)i.next();
      CurrinRef param = m.getElementAt(where);
      _param_refs.add(param);
  }
  return new CurrinRef(new CurrinFunction(_function_to_run, _param_refs));
    }
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

    public void exec(Machine m) {
  Logger logger = Logger.getLogger("Runtime");
  logger.debug("Running Enter instruction");
  Memory mem = m.getContextStack().currentContext().getMemory();
  CurrinRef cr = mem.getElementAt(_what);
  if ( cr == null )
      logger.debug("Chungo");
  cr.evaluate(m);
  m.setResult(cr);

    }
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

    public void exec(Machine m) {
  Logger logger = Logger.getLogger("RuntimeLogger");
  logger.debug("Run LET ");

  Memory mem = m.getContextStack().currentContext().getMemory();
  CurrinRef cr = _what.getMemoryForm(mem);

  mem.setElementAt(_where, cr);
    }
View Full Code Here

Examples of org.asturlinux.frade.currin.program.type.CurrinRef

  throws InterpreterException {
  Logger logger = Logger.getLogger("RuntimeLogger");
  logger.debug("Running Switch ");

  Memory mem = m.getContextStack().currentContext().getMemory();
  CurrinRef switcher = mem.getElementAt(_selector);
  if ( switcher == null ) {
      throw new InterpreterException("Switcher nulo en Switch");
  }

  Iterator i = _cases.iterator();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.