0

Hello I am currently reading the Build Your Own Lisp book online and have reached the parsing chapter. I am enjoying the book very much, but instead of using the author's parser I would like to roll my own. I feel like I would learn more about language design if I went down this route. Do you have any resources that can help me go about doing this? Anything is appreciated and thank you!

HoodedMan
  • 65
  • 3

2 Answers2

4

I haven't read that specific book, but my general advice is to first do every exercise exactly as shown in the book. After you get that running, you're obviously free to change anything you want.... but remember to undo (or revert) everything to the 'official' version before advancing further in the book.

Javier
  • 60,510
  • 8
  • 78
  • 126
1

Building a generic reusable parsing tool like the author has is going to be a ridiculous amount of work.

But hacking something up a for a lisp interpreter shouldn't be all that complicated. Or at least this is what I keep reading all over the place. I went ahead and wrote my own. But it has had many bugs removed, and some surely still remain. Parsing is tricky.

Simple version: https://stackoverflow.com/a/21952112/733077

Latest version: https://github.com/luser-dr00g/sexp.c/blob/master/sexp.c

Community
  • 1
  • 1
luser droog
  • 18,988
  • 3
  • 53
  • 105