hack_assembler/lib.rs
1/// This module parses Hack assembly and produces a vector of instructions as output on success,
2/// or a detailed error message with error location on parse failure.
3mod hack_parser;
4/// This module converts the vector of instructions outputed by hack_parser to binary Hack code.
5mod hack_emitter;
6
7pub fn assemble(source: &str) -> Result<String, String>
8{
9 hack_parser::parse(source).map(
10 |ast| hack_emitter::emit(ast)
11 )
12}