package interpres.ast;

import java.util.List;
import java.util.ArrayList;

import interpres.language.DefinitionTable;
import interpres.language.values.Value;

public class StringLiteral extends AST {
  private String literal;

  public StringLiteral(String literal) {
    this.literal = literal;
  }

  public Value evaluate(DefinitionTable definitionTable) {
    List<String> instructions = new ArrayList<String>();

    for (int i = literal.length() - 1; i >= 0; i--) {
      instructions.add("LOADL " + (int) literal.charAt(i));
    }

    return new interpres.language.values.List(instructions);
  }

  public String quote() {
    return this.literal;
  }
}


package interpres.ast;

import java.util.List;
import java.util.ArrayList;

import interpres.language.DefinitionTable;
import interpres.language.values.Value;

public class StringLiteral extends AST {
  private String literal;

  public StringLiteral(String literal) {
    this.literal = literal;
  }

  public Value evaluate(DefinitionTable definitionTable) {
    return ListExpression.buildFunctionCall("asm.loads", new QuotedExpression(this)).evaluate(definitionTable);
  }

  public String quote() {
    return this.literal;
  }
}


Call asm.loads when a string is encountered
Call asm.loads when a string is encountered
