defmodule Writer do @moduledoc """ Writes the target language code (assembly x86 64 bit) file to the current working directory. """ @doc """ Writes the assembly file, ```exc_o.s``` using the code generated by `CodeGenerator.generate_code/2`, to the current directory. ### Specs ```asm_code```is the assembly code generated by the `CodeGenerator.generate_code/2` Returns ```exc_o.s``` file that contains the assembly code generated by the ExC. """ def write_file(asm_code) do output_path = build_output_path() File.write(output_path, asm_code) output_path end defp build_output_path() do base_directory = "./" output_code_file_name = "exc_o.s" base_directory <> output_code_file_name end end