←back to thread

429 points rui314 | 1 comments | | HN request time: 0.207s | source
Show context
sdegutis ◴[] No.10731279[source]
Thought this was going to be an inspiration to me to continue with my pet project of writing my own little programming language. But it starts off on day 8 with him already having written a basic compiler, with no explanation of how he did any of the basics. Still interesting, just not what I thought it was.
replies(5): >>10731293 #>>10731295 #>>10731322 #>>10731384 #>>10731600 #
c4n4rd ◴[] No.10731322[source]
Same here. I have been trying the same project as you... and get stuck on the grammar, every.single.time.

Are you done with that part yet?

replies(6): >>10731391 #>>10731413 #>>10731690 #>>10731969 #>>10733429 #>>10736115 #
1. jerf ◴[] No.10731391[source]
What do you mean "stuck on the grammar"? Can't figure out how to write a grammar, can't get all the fiddly implications correct so OOO fails, can't figure out how to write the parser, can't muster up enough enthusiasm to finish the work...?

One option is to punt for a bit and use what I sometimes call the "Lisp non-grammar", even if you don't intend to be writing a Lisp; use parentheses to directly encode a parse tree, and whatever other hacky symbols you need for now to set up atom types or whatever. You might still be able to explore enough what you're interested in to figure out what you want in the grammar. Whatever the core idea of your toy language is, you should try to get to that as quickly as possible, punting on everything else you possibly can, so if the point of your language isn't to have an innovative new grammar, you might want to try to defer that work.