The Theory of Programming Languages
Pascal, Scheme and Prolog - oh my. The last class in Computer Science at Liberty is Theory of Programming Languages. The professor, Solomon Gifford, is a graduate from Virginia Tech and tried to structure his courses in a similar fashion to that of his alma mater. At Tech, the course requires students to implement an interpreter for 4 different sample languages in 4 different base languages. In our course Solomon requires us to implement “Our Simple Interpreted Language” in Pascal, Scheme and Prolog.
Pascal contained most of the imperative language features that can be found in languages like C++, Java, or C#. I made this project particularly difficult on myself because I wrote everything iteratively. If I could go back and rework the first O.S.I.L., I could complete it in about half the time.
The Scheme version of our interpreter was my favorite of the three. Solomon required us not to use any of the imperative functionality in the language which included the use of variables. It was very confusing at first, but once I understood that everything required recursion I stopped thinking iteratively and the language clicked. Each of the procedures would take a list containing code to interpret as well as a list of 26 variables.
The last version of O.S.I.L. was the most foreign to me. I can honestly say I would be happy never programming in a logic based language like Prolog again. The language syntax was so completely different then anything else that I had ever seen before. The big benefits to this implementation were the declaration of the BNF. Rules were created which declared valid sentences in the language. For instance, an expression would contain at least an operator or an operator, an operand, and another operator. If you tried to use 8, +, +, 9 the rule would not apply, making it extremely easy to perform syntax checking. Essentially, anything that didn’t meet a rule was invalid syntax.




