<commit_before>#include "GasCodeGenerator.h"

using namespace common;
using namespace std;

GasCodeGenerator::GasCodeGenerator(std::ostream &os) : visitor::CodeGenerator::CodeGenerator(os), os(os) {
}

void GasCodeGenerator::visit(Program *node) {

}

void GasCodeGenerator::visit(Function *node) {

}

void GasCodeGenerator::visit(Case *node) {

}

void GasCodeGenerator::visit(Or *node) {

}

void GasCodeGenerator::visit(And *node) {

}

void GasCodeGenerator::visit(Equal *node) {

}

void GasCodeGenerator::visit(NotEqual *node) {

}<commit_msg>GasCodeGen: Now generates the base function body * Also generates jump points for cases<commit_after>#include "GasCodeGenerator.h"
#include <iostream>
#include <vector>

using namespace common;
using namespace std;

std::string function;

vector<string> funcVector;
vector<string> funcGlobl;

int caseCount = 0;

GasCodeGenerator::GasCodeGenerator(std::ostream &os) : visitor::CodeGenerator::CodeGenerator(os), os(os) {
}

void GasCodeGenerator::visit(Program *node) {
    // Visit all functions
    for (auto func : node->funcs) {
        func->accept(this);
    }

    // Print all functions to output stream
    for (auto s : funcVector) {
        std::cout << s << std::endl;
    }
}

void GasCodeGenerator::visit(Function *node) {
    string funcName = node->id;
    funcGlobl.push_back(funcName);
    function.append(funcName);
    function.append(":\n");
    function.append("pushl %ebp\n");
    function.append("movl %esp, %ebp\n");
    function.append(".");
    function.append(funcName);
    function.append("funcstart:\n");

    caseCount = 0;

    for (auto funcCase : node->cases) {
        funcCase->accept(this);
    }

    function.append(".");
    function.append(funcName);
    function.append("funcend:\n");
    function.append("movl %ebp, %esp\n");
    function.append("popl %ebp\n");
    function.append("leave\n");
    function.append("ret\n");

    funcVector.push_back(function);

    function.clear();
}

void GasCodeGenerator::visit(Case *node) {
    caseCount++;
    function.append(".case");
    function.append(to_string(caseCount));
    function.append(":\n");
}

void GasCodeGenerator::visit(Or *node) {

}

void GasCodeGenerator::visit(And *node) {

}

void GasCodeGenerator::visit(Equal *node) {

}

void GasCodeGenerator::visit(NotEqual *node) {

}
{'fraction_non_alphanumeric': 0.15308747855917668, 'fraction_numerical': 0.0008576329331046312, 'mean_word_length': 4.438228438228438, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 12, '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': '5098038', 'n_tokens_mistral': 767, 'n_tokens_neox': 750, 'n_words': 149}