Merge compiler and emulator progress from last few months into main. #11

Merged
zxq5 merged 55 commits from compiler into main 2026-02-14 11:54:15 +00:00
3 changed files with 10 additions and 19 deletions
Showing only changes of commit f25db6c8fd - Show all commits
+1 -2
View File
@@ -14,8 +14,7 @@ pub fn codegen(nodes: Vec<Node>) -> Result<Vec<Instruction>, AssembleError> {
instructions.push(build_instruction(&node)?);
}
println!("------------------------");
log("Compilation Success ✅");
log("Assembly Successful ✅");
Ok(instructions)
}
+1 -1
View File
@@ -65,7 +65,7 @@ pub fn lexer(mut program: String, module: u64) -> Result<Vec<Token>, AssembleErr
}
}
println!("{:#?}", tokens);
// println!("{:#?}", tokens);
Ok(tokens)
}
+8 -16
View File
@@ -9,13 +9,9 @@ use std::{
thread,
};
pub use common::logging::log;
use common::prelude::Instruction;
// TODO: Use an actual logging or tracing library for pretty (scoped) output.
fn log(message: &str) {
println!("\x1b[32mINFO:\x1b[0m {message}");
}
// Module declarations
#[macro_use]
pub mod macros;
@@ -138,12 +134,11 @@ fn assemble(src: &Path) -> Result<Vec<Instruction>, AssembleError> {
create_sections(&mut nodes)?;
resolve_symbols(&mut nodes)?;
println!("Generating assembly output...");
for n in &nodes {
println!("{n}");
}
log("Generating assembly output...");
let instructions = codegen(nodes)?;
log("Compilation Successful");
Ok(instructions)
}
@@ -192,10 +187,7 @@ fn prepare_dependency(
let deps = Parser::get_dependencies(&nodes, path)?;
log(&format!(
"{:20} {:20}",
"Expanding PseudoInstructions", filename
));
log(&format!("{:20} {:20}", "Expanding Pseudo-ops", filename));
// add a section instruction
nodes.insert(
@@ -203,9 +195,9 @@ fn prepare_dependency(
node!(None, Opcode::Segment, Token::Immediate(file_hash as u32)),
);
for n in &nodes {
println!("{n}");
}
// for n in &nodes {
// println!("{n}");
// }
program.add_module(nodes);