Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split up responsibilities of Compiler #27

Open
fwcd opened this issue Feb 21, 2023 · 0 comments
Open

Split up responsibilities of Compiler #27

fwcd opened this issue Feb 21, 2023 · 0 comments
Labels
refactoring Improvements to the program's structure
Milestone

Comments

@fwcd
Copy link
Collaborator

fwcd commented Feb 21, 2023

For improved testability, it would be cool to factor out the explicit path and file handling from Compiler and divide up its responsibilities into individual methods or perhaps even different modules:

  • Generate instructions as Vec<Instruction>
  • Prettyprint Vec<Instruction> to a .asm source file (or, if that's not sufficient, introduce a new struct for representing a complete .asm file abstractly and generate that instead)
  • Running nasm on the resulting .asm source file
  • Linking the object files

This should also make it easier to perform non-black box testing, since we could perform assertions directly on the generated instructions for a block of code.

@fwcd fwcd added the refactoring Improvements to the program's structure label Feb 21, 2023
@H1ghBre4k3r H1ghBre4k3r added this to the v0.2.0 milestone Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Improvements to the program's structure
Projects
None yet
Development

No branches or pull requests

2 participants