I need to add classes to the triangle programming language, i.e. need
an object orieneted version of Triangle compiler. Its pretty
complicated for me, I am actually trying to work on type systems for
object oriented languages, and chose Triangle for it, as I was familiar
with it. But, unfortunately it didn't have notion of classes in it. Can
anybody give me a good reference or a jumpstart.
What are you looking for:
1) How to design an OO language ?
2) How to design an OO extension to an existing language ?
3) Implementation techniques for OO languages ?
4) How to design a type system for an OO language ?
5) An OO language that might be better suited for your purposes than Triangle ?
6) Etc ??
The impression I'm getting is that you are not interested in Triangle per se,
and that adding OO to it is just a chore that you have to get out of the way
before you can settle down to the real work. If so then starting with Triangle
seems odd -- if you wanted to learn about jet engine design, you wouldn't start
by bolting wings on your car ;-)
Some suggested answers:
1) Learn an existing language. Smalltalk (best), Ruby (ok), Python (it may
suit your personal taste better than Ruby), CLOS/Lisp (powerful and much you
can learn from), Java (poor), C++ (bad).
2) Look at how OO has been grafted onto existing languages. C converted to C++
(Read Stoustrup's book). Pascal converted to Delphi. Python (early, non-OO)
converted to Python (current, with OO). Lua, non-OO but specifically designed
to allow OO to be layered over it. CLOS added to Lisp (read the "Art of the
Metaobject Protocol" book).
3) See (4).
4) This is a biggie. How you design your type system will determine the
expressiveness of the language, which in turn will constrain the
implementation. See (1) for some examples. There is also a moderately large
and (to me) totally incomprehensible literature on theories of type systems for
OO. The name Cardelli drops up often, and is to be treated with wary respect
(as you might an unexploded tiger).
5) See (1).
-- chris