<commit_before>#include "interpreter.h"
#include "pool.h"
#include "object.h"
#include "../parser/expressions.h"
#include "../native/boolean_methods.h"
#include "../native/nil_methods.h"


FxI_Interpreter *FxI_Interpreter_create(int literal_capacity, int class_capacity, int lookup_capacity) {
  FxI_Interpreter *self = fx_alloc(FxI_Interpreter);
  verify_memory(self);

  FxI_Pool *pool = FxI_Pool_create(literal_capacity, class_capacity, lookup_capacity);
  verify(pool);
  fxi_interpreter_pool(self) = pool;

  return self;
error:
  if (self) { fx_pfree(self); }
  return NULL;
}

void fxi_interpreter_add_base_classes(FxI_Interpreter *self) {
  FxI_Pool *pool = fxi_interpreter_pool(self);

  // do stuff to setup classes
  // Object
  // Boolean
  // Nil
  // Integer
  // Float
  // String
  // EvalString
  // Function
  // Regex
  // Symbol ??
}

void fxi_interpreter_add_base_literals(FxI_Interpreter *self) {
  FxI_Pool *pool = fxi_interpreter_pool(self);

  FxP_Expression *false_literal = FxP_Literal_create(NULL, TOKEN_FALSE);
  FxN_Object *false_object = FxN_Boolean_create(pool, false_literal);

  FxP_Expression *true_literal = FxP_Literal_create(NULL, TOKEN_TRUE);
  FxN_Object *true_object = FxN_Boolean_create(pool, true_literal);

  FxP_Expression *nil_literal = FxP_Literal_create(NULL, TOKEN_NIL);
  FxN_Object *nil_object = FxN_Boolean_create(pool, nil_literal);

  fxi_literal_set(pool, FALSE_KEY, false_object);
  fxi_literal_set(pool, TRUE_KEY,  true_object);
  fxi_literal_set(pool, NIL_KEY,   nil_object);
}<commit_msg>switches interpreter setup to eval literal expressions instead of doing special object creation and insertion<commit_after>#include "interpreter.h"
#include "expression_eval.h"
#include "pool.h"
#include "object.h"
#include "../parser/expressions.h"
#include "../native/boolean_methods.h"
#include "../native/nil_methods.h"


FxI_Interpreter *FxI_Interpreter_create(int literal_capacity, int class_capacity, int lookup_capacity) {
  FxI_Interpreter *self = fx_alloc(FxI_Interpreter);
  verify_memory(self);

  FxI_Pool *pool = FxI_Pool_create(literal_capacity, class_capacity, lookup_capacity);
  verify(pool);
  fxi_interpreter_pool(self) = pool;

  return self;
error:
  if (self) { fx_pfree(self); }
  return NULL;
}

void fxi_interpreter_add_base_classes(FxI_Interpreter *self) {
  FxI_Pool *pool = fxi_interpreter_pool(self);

  // do stuff to setup classes
  // Object
  // Boolean
  // Nil
  // Integer
  // Float
  // String
  // EvalString
  // Function
  // Regex
  // Symbol ??
}

void fxi_interpreter_add_base_literals(FxI_Interpreter *self) {
  FxI_Pool *pool = fxi_interpreter_pool(self);

  FxP_Expression *false_literal = FxP_Literal_create(NULL, TOKEN_FALSE);
  fxi_evaluate(self, false_literal);

  FxP_Expression *true_literal = FxP_Literal_create(NULL, TOKEN_TRUE);
  fxi_evaluate(self, true_literal);

  FxP_Expression *nil_literal = FxP_Literal_create(NULL, TOKEN_NIL);
  fxi_evaluate(self, nil_literal);
}
{'fraction_non_alphanumeric': 0.11058823529411765, 'fraction_numerical': 0.0, 'mean_word_length': 5.2521008403361344, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2859461', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1109, 'n_words': 199}