Hello everyone.
For pedagogical reasons, I've decided to try and write for myself a simple, LL(1)-type programming language targeting the 65816 processor with a syntax not entirely dissimilar to that of Rust. Think something like Tiny-C, except with a Rust-y syntax. I decided to call it ROIL, for Rust/Oberon Inspired Language.
I've been following a technique used in the "15 compilers in 15 days" paper, namely building the compiler up in incremental pieces using test-driven programming techniques. As I work through the project so far, I've been getting encouraging results.
Until now. After refactoring some code that belongs in a parser into the parser.rs module proper, I'm now receiving a slew of E0503 errors. I've pushed my code to my "incubator" repository so everyone can see (and clone and poke around if they want; I welcome this, in fact) my work so far. I apologize if the code is not well structured; please remember this is all work in progress material.
As the code comment indicates, I'm baffled about why I'm getting an E0503 error mid-way through the grammar rule method that handles let-bindings (g_let
).
If anyone has any recommendations on how to restructure the code so as to work around this issue, I'd be appreciative. Thanks in advance.
Prior research: I've looked here on the forums for similar issues involving E0503, but while there were many articles which popped up, none of them seemed to touch on my specific set of circumstances. rustc --explain E0503
yielded similarly "this is obvious, but I don't know how it relates" answers to my problem. So, I've resorted to posting a new topic here in the hopes that this adds to the knowledge base somehow.
NOTE: Because I know at least one person will recommend using a parser generator or combinator library, please don't. The reason I'm not is because I want the experience of having done it myself first. This is an exercise for myself to learn how to write non-trivial code in Rust. If I were writing for a commercial-grade product, or contributing to someone else's project, etc., then of course I'd use or recommend pre-existing tools. Thanks!