The Elements of Computing Systems: How to parse the jack language?

I’m working through the book The Elements of Computing Systems by Nisan and Schocken and doing all the implementation in Rust. I’m up to Chapter 9, where I have to write a parser for the Jack language, which can be fairly described as a simplified version of Java. The book suggests a separate tokenizer and recursive descent parser. I used nom for the parsing in the previous chapters where the languages were quite a bit simpler, but making a parser for a whitespace-delimited language with nom seems a bit cumbersome. What’s my best option here? I’d rather avoid manually writing the parser if possible. Maybe writing a tokenizer and then using nom to parse the token stream instead of the source code would be a good middle ground?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.