diff options
author | Ben Bridle <bridle.benjamin@gmail.com> | 2024-10-28 19:52:29 +1300 |
---|---|---|
committer | Ben Bridle <bridle.benjamin@gmail.com> | 2024-10-28 19:52:47 +1300 |
commit | f4027cae775e3c9c237675f9df35a744d54f3f2e (patch) | |
tree | 733fa3af9e1bd44d61dd83983a2da86cb75c53e9 /src/lib.rs | |
parent | 16ee0e9e8dce2c88acc88ba5ffd97e013624fa5e (diff) | |
download | bedrock-asm-f4027cae775e3c9c237675f9df35a744d54f3f2e.zip |
Rewrite assembler
This is an almost complete rewrite of the entire assembler from the
ground up, with a different parsing strategy and a whole new symbol
resolution mechanism for automatically including library files.
The assembly syntax has also been slightly modified, with padding
tokens now being prefixed with '#' instead of '$', and a block-style
anonymous-label syntax which uses the '{' and '}' characters.
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 35 |
1 files changed, 17 insertions, 18 deletions
@@ -1,21 +1,20 @@ -mod addressing; -mod syntactic_token; -mod semantic_token; -mod tokenizer; -mod error; -mod assembler; +#![feature(io_error_more)] +#![feature(map_try_insert)] -pub use addressing::{CharAddress, SourceLocation, BytecodeLocation}; -pub use syntactic_token::{SyntacticToken, SyntacticTokenType}; -pub use semantic_token::{SemanticToken, SemanticTokenType, LabelDefinition, MacroDefinition}; -pub use error::Error; -pub use tokenizer::TokenIterator; -pub use assembler::Assembler; -pub fn assemble(source_code: &str) -> (Vec<u8>, Vec<SemanticToken>) { - let mut assembler = Assembler::new(); - assembler.tokenise_source(source_code); - assembler.resolve_references(); - assembler.generate_bytecode() -} +mod gather_libraries; +mod symbol_resolver; +pub use gather_libraries::*; +pub use symbol_resolver::*; + +mod locators; +mod tokens; +mod translators; + +pub use locators::*; +pub use tokens::*; +pub use translators::*; + +mod print; +pub use print::*; |