Wassup! I got the thing to compile, and I've added more stuff! Also, Github repository link go go go! (edit: apparently it's displaying the wrong GH-Actions badge here, but it displays correctly on github. Caching issue, maybe?)
AshtonSnapp / hasm
The Official Cellia Cross-Assembler for Modern Computers
hasm
The Homebrew Assembler. Currently supporting the 16-bit Cellia architecture and the 8-bit ROCKET88 architecture.
Each architecture supported by hasm
will be separated into its own module, although every architecture's assembler code will have the same general structure: you have a lexer which takes in files of assembly code and outputs streams of tokens which are fed into a parser which structures those tokens into a file syntax tree. Then the syntax trees are fed into a linker which tries to combine all of these trees into a single program tree, which is finally fed into a binary generator which does exactly what you think.
Right now I'm still trying to implement the assemblers for the two architectures I mentioned earlier, and I've only just now gotten to the parser. It's going to be a pain to write anything that's actually decently capable, but it'll be worth…
So, I got the lexer to work. Finally. It compiles. I've done a few things since last post to 1) get the thing to compile, and 2) whittle down on the number of compiler warnings. First off, the error from last time was fixed by actually passing strings into the lexer. I did that by making a function which takes a file and verbose flag and makes a lines iterator over the file, which feeds each line into the lexer. Then it checks for errors. Hopefully someday this assembler will have errors that are as helpful as rustc's, but for now they're just "hey there's an error on this line and it has this byte span. what, you want the character span? Good luck, Unicode is strange." I also had to implement all of the callback functions, and then it finally compiled.
But I still got compiler warnings to deal with. First, some warnings said that certain enum variants were never constructed. Simple fix, just implement (derive) the serde::Serialize
and serde::Deserialize
traits on everything that isn't a function inside the lex.rs
file. I probably did some other stuff to get rid of other warnings, but I'm not perfect and neither is my memory
What I do know is that I have two warnings left to get rid of, and they're confusing. Apparently, certian callback functions are apparently never used, those being instruction_large
and instruction_xlarge
. Only those two. I have no idea why it's just those two functions, and I have no idea why they aren't being used. It's a mystery.
Well, besides those two remaining warnings, the lexer is finished. Including the two warnings, I've still got some work to do before I can move on to the parser. Nevertheless, I hope all of you have an awesome day!
Top comments (0)