←back to thread

429 points rui314 | 1 comments | | HN request time: 0.245s | 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. PeCaN ◴[] No.10736115[source]
Let me guess, you're stuck fighting yacc and shift-reduce conflicts?

I find writing your own parser to be much more instructive and a better way to understand why parser generators work the way they do.

Alternatively you can use a PEG generator such as peg/leg[1] and your grammar will more or less work (until it resolves an ambiguity in some way you didn't expect, anyway).

1: http://piumarta.com/software/peg/