News for hackers. Stuff that matters.
Re:Prologue: Full-Stack Web Framework Written in Nim by half-kh-hacker on Monday June 08, 2020 @04:37AM (#23454760)
I'm curious: Is there anything you're using for parsing in Nim?
Re:Prologue: Full-Stack Web Framework Written in Nim by frankpf on Monday June 08, 2020 @08:32PM (#23462364)
I'm in the process of rewriting the language from typescript to nim, so right now it's a recursive descent parser written in typescript[1]. Typescript generates the textual bytecode and that feeds into a Nim interpreter.[2]

I think I'll keep the recursive descent parser even after rewriting to Nim. It's easy to change the grammar and understand how it works, and I can have good error messages & handling.

IMO the main problem is that right now the code for parsing infix expressions is fairly repetitive, I'd like to eventually use Pratt parsing for that.

[1]: https://github.com/frankpf/kiwi/blob/vm/src/parser.ts [2]: https://github.com/frankpf/kiwi/blob/vm/src2/src/interpreter...