Wednesday, July 07, 2010

Recursive Descents

Many years ago I frequently programmed my computer in the Pascal language.

At one point, I wanted to learn how to write a program that could take an arbitrary algebraic expression and come up with the correct answer based on the variables, operators, and the order of precedence. I actually succeeded in writing a simple calculator with add, subtract, multiply, divide and parenthesis. This was a learning experience for me and was based on an article in a programming journal plus my own adaptations.

Recently, I found this quote on Wikipedia:

"A recursive descent parser is a top-down parser built from a set of mutually-recursive procedures (or a non-recursive equivalent) where each such procedure usually implements one of the production rules of the grammar. Thus the structure of the resulting program closely mirrors that of the grammar it recognizes."

Now that I read this definition, I'm pretty sure I can't remember how it's done.


No comments:

Post a Comment

Thanks for stopping by.