<commit_before>#include "MiddleEnd.hpp"

namespace MiddleEnd
{
  AP(Scope) MiddleEnd::loadScopes(AP(Module)& ast)
  {
    AP(Scope) global(new BlockScope(NULL));
    loadBuiltinTypes(global);
    return global;
  }

  void MiddleEnd::loadBuiltinTypes(AP(Scope)& global)
  {
    vector<Type>& table = global->types;
    table.push_back(new IntegerType("char", 1, true));
    table.push_back(new AliasType("i8", &table.back()));
    table.push_back(new IntegerType("uchar", 1, false));
    table.push_back(new AliasType("u8", &table.back()));
    table.push_back(new IntegerType("short", 2, true));
    table.push_back(new AliasType("i16", &table.back()));
    table.push_back(new IntegerType("ushort", 2, false));
    table.push_back(new AliasType("u16", &table.back()));
    table.push_back(new IntegerType("int", 4, true));
    table.push_back(new AliasType("i32", &table.back()));
    table.push_back(new IntegerType("uint", 4, false));
    table.push_back(new AliasType("u32", &table.back()));
    table.push_back(new IntegerType("long", 8, true));
    table.push_back(new AliasType("i64", &table.back()));
    table.push_back(new IntegerType("ulong", 8, false));
    table.push_back(new AliasType("u64", &table.back()));
    table.push_back(new FloatType("float", 4));
    table.push_back(new AliasType("f32", &table.back()));
    table.push_back(new FloatType("double", 8));
    table.push_back(new AliasType("f64", &table.back()));
    table.push_back(new StringType);
  }

  void MiddleEnd::semanticCheck(AP(Scope)& global)
  {
  }

  void MiddleEnd::checkEntryPoint(AP(Scope)& global)
  {
  }

  namespace TypeLoading
  {
    void MiddleEnd::visitModule(Scope* current, AP(Module)& module)
    {
      //create new scope, add to current
      for(auto& decl : module->def->decls)
      {
      }
    }

    void MiddleEnd::visitBlock(Scope* current, AP(Block)& module)
    {
    }<commit_msg>Working on type loading<commit_after>#include "MiddleEnd.hpp"

namespace MiddleEnd
{
  AP(Scope) MiddleEnd::loadScopes(AP(Module)& ast)
  {
    AP(Scope) global(new BlockScope(NULL));
    loadBuiltinTypes(global);
    return global;
  }

  void MiddleEnd::loadBuiltinTypes(AP(Scope)& global)
  {
    vector<Type>& table = global->types;
    table.push_back(new IntegerType("char", 1, true));
    table.push_back(new AliasType("i8", &table.back()));
    table.push_back(new IntegerType("uchar", 1, false));
    table.push_back(new AliasType("u8", &table.back()));
    table.push_back(new IntegerType("short", 2, true));
    table.push_back(new AliasType("i16", &table.back()));
    table.push_back(new IntegerType("ushort", 2, false));
    table.push_back(new AliasType("u16", &table.back()));
    table.push_back(new IntegerType("int", 4, true));
    table.push_back(new AliasType("i32", &table.back()));
    table.push_back(new IntegerType("uint", 4, false));
    table.push_back(new AliasType("u32", &table.back()));
    table.push_back(new IntegerType("long", 8, true));
    table.push_back(new AliasType("i64", &table.back()));
    table.push_back(new IntegerType("ulong", 8, false));
    table.push_back(new AliasType("u64", &table.back()));
    table.push_back(new FloatType("float", 4));
    table.push_back(new AliasType("f32", &table.back()));
    table.push_back(new FloatType("double", 8));
    table.push_back(new AliasType("f64", &table.back()));
    table.push_back(new StringType);
  }

  void MiddleEnd::semanticCheck(AP(Scope)& global)
  {
  }

  void MiddleEnd::checkEntryPoint(AP(Scope)& global)
  {
  }

  namespace TypeLoading
  {
    void MiddleEnd::visitModule(Scope* current, AP(Module)& module)
    {
      //create new scope, add to current
      AP(ModuleScope
      for(auto& decl : module->def->decls)
      {
      }
    }

    void MiddleEnd::visitBlock(Scope* current, AP(Block)& module)
    {
    }
{'fraction_non_alphanumeric': 0.17358392064735056, 'fraction_numerical': 0.014617593317671627, 'mean_word_length': 4.35944055944056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '6672833', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1296, 'n_words': 236}