I am trying to build a toy-compiler with the Rust programming language and am currently struggeling with the Rust’s way of doing things.
I already planned out the compiler (hopefully detailed enough so that you guys can follow) and it can be found at:
GitHub Gist Link
It includes everything of the first few parsing components up to the Parser generation of the abstract syntax tree which should be enough as a start.
Rationals about why I want to design the things the way I stated are also included and hopefully reasonable.
My main concerns are about the way I try to use the
Source class as the owner of information at which other entities (such as Tokens) are pointing to.
It would be nice if you guys could validate my design approach for implementation in the Rust programming language or tell me what will certainly fail and what I could do otherwise.
Besides that I am always welcoming general improvements to the current design!
Thanks in advance to anybody taking his or her time to read through all this and finally help me!