r/programming • u/dominatrix-octopus • Jan 16 '18
Cryptography: Diffie-Hellman key exchange explained intuitively using colors
https://youtu.be/YEBfamv-_do?t=2m18s
2.5k
Upvotes
r/programming • u/dominatrix-octopus • Jan 16 '18
View all comments
Show parent comment
2
u/tavianator Jan 17 '18
Honestly I don't know any really good introductions to grammars/parsing. I learned from messing around with yacc as a kid and then later from university courses. Probably Wikipedia too. I'd recommend taking your university's relevant courses (at mine, the information was spread out between a couple compilers courses and CS theory courses). You can probably peek ahead at their notes/textbook/assignments if you want.
A quick summary of the trick for parsing left-associative binary operators with recursive descent is that
is really the same thing as
where (X)* means zero or more repetitions of X. So just parse it with a loop: