4 ms·
I agree with 90%-95% of the article. I would phrase it more pithily as: 1. Use recursive descent for recognizing existing languages, where you have a good tes
by chubot 4y ago
I agree with 90%-95% of the article. I would phrase it more pithily as:
1. Use recursive descent for recognizing existing languages, where you have a good test corpus. (And very good point about testing INVALID inputs too!)
2. Use grammars to design new languages
I follow this with https://www.oilshell.org/ https://www.oilshell.org/ -- the compatible OSH is a huge recursive descent parser, and Oil is designed with a grammar.
Guy Steele and Russ Cox also mentioned this methodology -- design the language with a grammar, and then implement it a second time by hand. Then you REALLY know it! :)
It is definitely possible to not know the language you're implementing / creating!
---
As an undergrad, I never tried to design a language, or even thought about it honestly. But I agree that undergrads should know of both approaches, without necessarily getting into the details of CFGs.
It would be a mistake to just teach recursive descent.