<commit_before>/*
    Implementation of the Compiler class.


*/

#include "compiler.hh"
#include <string>

namespace ds_compiler {
    
size_t Compiler::NUM_REGISTERS = 8;
    
//constructors
Compiler::Compiler () {
    
}


void Compiler::compile_intermediate (std::istream &is, std::ostream &os) const {

}
    
void Compiler::compile_full (std::istream &is, std::ostream &os) const {
    
    compile_start(is, os);
    compile_intermediate(is, os);
    compile_end(is, os);
    
}

void Compiler::compile_start (std::istream &is, std::ostream &os) const {
    
    //emit lines for necessary includes
    emit_line("#include <stack>", os);
    emit_line("#include <vector", os);
    
    //emit lines for int main() {
    emit_line("int main () {", os);
    
    //create a stack and vector for registers
    std::string stack_init = "std::stack<int> cpu_stack;";
    std::string registers_init = "std::vector<int> cpu_registers(" + std::to_string(NUM_REGISTERS) + ", 0);";
    
    emit_line(stack_init, os);
    emit_line(registers_init, os);
    
}

void Compiler::compile_end (std::istream &is, std::ostream &os) const {
    
    //emit line for closing main
    emit_line("}", os);
    
}
    
    
} //end namespace<commit_msg>Fixed syntax errors in compile_start, compile_end.<commit_after>/*
    Implementation of the Compiler class.


*/

#include "compiler.hh"
#include <string>

namespace ds_compiler {
    
size_t Compiler::NUM_REGISTERS = 8;
    
//constructors
Compiler::Compiler () {
    
}


void Compiler::compile_intermediate (std::istream &is, std::ostream &os) const {

}
    
void Compiler::compile_full (std::istream &is, std::ostream &os) const {
    
    compile_start(is, os);
    compile_intermediate(is, os);
    compile_end(is, os);
    
}

void Compiler::compile_start (std::istream &is, std::ostream &os) const {
    
    //emit lines for necessary includes
    emit_line("#include <stack>", os);
    emit_line("#include <vector>", os);
    
    //emit lines for int main() {
    emit_line("int main () {", os);
    
    //create a stack and vector for registers
    std::string stack_init = "std::stack<int> cpu_stack;";
    std::string registers_init = "std::vector<int> cpu_registers(" + std::to_string(NUM_REGISTERS) + ", 0);";
    
    emit_line(stack_init, os);
    emit_line(registers_init, os);
    
}

void Compiler::compile_end (std::istream &is, std::ostream &os) const {
    
    //emit lines for closing main
    emit_line("return 0;", os);
    emit_line("}", os);
    
}
    
    
} //end namespace
{'fraction_non_alphanumeric': 0.14526894385551628, 'fraction_numerical': 0.0019630938358853552, 'mean_word_length': 3.348122866894198, 'pattern_counts': {'":': 0, '<': 13, '<?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': '298129', 'n_tokens_mistral': 858, 'n_tokens_neox': 850, 'n_words': 207}